Problem for java client comsuming .net web services [message #243116] |
Fri, 14 December 2007 12:08  |
Eclipse User |
|
|
|
Originally posted by: daviddabwang.yahoo.ca
It is my first time to use Eclipse to develop Web service client. I am in
trouble to figure my problem out. Please give a help. The situation is
described in the following. Thanks! David
1. I have developed a web service client by Java and using Axis1.4 under
Eclipse IDE as follows:
----
try{
String endpoint="http://ip/Resource/ResourceService.asmx?WSDL";
Service service=new Service();
Call call=(Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new
QName("http://tempuri.org/","GetXmlResources"));
//invoke the web method
//String ret = (String)call.invoke(new Object[]{1});
//Note the signiture of GetXmlResources is: String GetXmlResources(int)
call.addParameter("patientKey",
org.apache.axis.Constants.XSD_INT,javax.xml.rpc.ParameterMod e.IN);
call.setReturnType(org.apache.axis.Constants.XSD_STRING);
String ret = (String)call.invoke(new Object[]{1});
System.out.println("Data: " +ret);
}catch(Exception e){
System.err.print(e.toString());
}
----
There is no compilation error.
But when I run it, I got
"Server did not recognize the value of HTTP Header SOAPAction: ."
2. I luanch Web Services Explorer in Eclipse IDE for WSDL by adding URL:
"http://ip/Resource/ResourceService.asmx?WSDL", and select the method
GetXmlResources and input an int for the parameter patientKey, it works
and get the result that I expect.
3. Using Internet Explorer, I got a sample Soap request/response with
instruction: The placeholders shown need to be replaced with actual values.
-----
POST /Resource/ResourceService.asmx HTTP/1.1
Host: ip
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetXmlResources"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetXmlResources xmlns="http://tempuri.org/">
<patientKey>int</patientKey>
</GetXmlResources>
</soap:Body>
</soap:Envelope>
----
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetXmlResourcesResponse xmlns="http://tempuri.org/">
<GetXmlResourcesResult>string</GetXmlResourcesResult>
</GetXmlResourcesResponse>
</soap:Body>
</soap:Envelope>
----
4. When I use TCP/IP monitor in Eclipse IDE, it would not show any
information.
|
|
|
|
Powered by
FUDForum. Page generated in 0.09878 seconds