View Poll Results: Which would you use?
- Voters
- 4. You may not vote on this poll
-
Select Case
-
If ... Elseif...
-
Not Authorized as response connecting Webservice in a trusted Domain
Hi
I try to call a Webservice via java, the webservice is loacated on a IIS-server.
It is a trusted Domain so I do not have to Connect with a Username and Password.
It seems to be a problem to get Information fram the Service. At all I do not get Acces.
Anybody have same problem or experiance with this.
I use following Code to access the Webservice. If anybody have other suggestions I am willing to try that.
My Code.
import org.apache.soap.*;
import org.apache.soap.messaging.*;
import org.apache.soap.transport.http.*;
import javax.activation.*;
import org.xml.sax.*;
import java.io.*;
import java.util.Iterator;
public class JavaAgent {
Public void NotesMain() {
try {
String retval = "";
String url ="http://xxxxxxxxx.asmx";
System.out.println("url"+url);
String TargetNamespace ="http://tempuri.org/";
String SOAPAction ="http://tempuri.org/GetFunctione1";
if (url == null) {
throw new org.apache.soap.SOAPException(Constants.FAULT_CODE_CLIENT,
"A URL must be specified via " +
"SoapBuildersExSoapProxy.setEndPoint(URL).");
}
// Instantiate the message and the envelope.
// The message sends the envelope and gets
// the response.
Message message = new Message();
Envelope env = new Envelope();
DataHandler soapMsg = null;
// Get this from the soapAction attribute on the
// soap peration element that is found within the SOAP
// binding information in the WSDL.
MessageBody theBody = new MessageBody();
theBody.orgId ="C42F504C40BB0A1EC1256F3F0032A80B";
theBody.dokType="6";
// Replace the default body with our own.
env.setBody( theBody );
message.send(new java.net.URL(url) , SOAPAction, env );
try{
// Because the Body.unmarshall handler is static,
// you cannot replace the basic machinery easily.
// Instead, you must obtain and parse the
// message on your own.
soapMsg = message.receive();
System.out.println( "***Result***: " + soapMsg.getContent().toString());
} catch ( Exception e ) {
System.out.println( "***Exception***: " + e.toString() );
}
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
JavaAgent ja = new JavaAgent();
ja.NotesMain();
}
}
ddddddddddddddddddd
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks