Hi
I try to call a Webservice via
java, the webservice is loacated on a IIS-server.
The security setup created as a trusted Domain so I do not have to Connect with a Username and Password. The Webservice should know Who I am since I am in the same network.
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
// soapperation 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();
}
}