You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Rahul Kirthivasan <he...@yahoo.com> on 2001/04/25 13:05:39 UTC
Java Client Interoperating with .NET Web Service
Hi all,
Has anybody got Java to work with the WebService
exposed through .NET remoting. I have an Class called
Author in the AuthorDetails namespace.
It has a single method with the following sig :
String getAuthorDetails(String strAuthorName)
The object is exposed at a well know URN endpoint
called URN:Author
If I use a .NET client to access the object,
everything goes fine. But when I use a java client
using Apache SOAP, then I get an exception :
--------------------------------------------------
java.lang.NullPointerException
at
org.apache.soap.transport.TransportMessage.read(TransportMessage.java:206)
at
org.apache.soap.util.net.HTTPUtils.post(HTTPUtils.java:296)
at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:208)
at
org.apache.soap.rpc.Call.invoke(Call.java:203)
at
AuthorJavaClient.invoke(AuthorJavaClient.java:97)
at
AuthorJavaClient.main(AuthorJavaClient.java:181)
-------------------------------------------------------This
is the SOAP packet that is sent by the JAVA client :
-------------------------------------------------------
POST /URN:Author HTTP/1.0
Host: localhost:9000
Content-Type: text/xml; charset=utf-8
Content-Length: 541
SOAPAction:
"http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails.Author/Authordetails#getAuthorDetails"
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:getAuthorDetails
xmlns:ns1="http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails.Author/Authordetails"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<strAuthorName xsi:type="xsd:string">John
Doe</strAuthorName>
</ns1:getAuthorDetails>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-----------------------------------------------
This is the SOAP packet that is sent out by the
.NET client that seems to work fine :
-----------------------------------------------
POST /URN:Author HTTP/1.1
SOAPAction:
"http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails.Author/Authordetails#getAuthorDetails"
Content-Type: text/xml
Content-Length: 1061
Connection: Close
Host: localhost
<SOAP-ENV:Envelope
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:a2="http://schemas.microsoft.com/urt/NS/System.Runtime.Remoting"
xmlns:a1="http://schemas.microsoft.com/urt/NS/System"
xmlns:i7="http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails.Author/Authordetails">
<SOAP-ENV:Header>
<__CallContext href="#ref-3" root="1"/>
<a1:LogicalCallContext id="ref-3">
<__RemotingData href="#ref-4"/>
<__SecurityData href="#ref-5"/>
</a1:LogicalCallContext>
<a2:CallContextRemotingData id="ref-4">
<_logicalCallID
id="ref-6">99ad0c5a-0db0-4ed3-9a72-d87b80c29c02_1</_logicalCallID>
</a2:CallContextRemotingData>
<a1:CallContextSecurityData id="ref-5">
</a1:CallContextSecurityData>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<i7:getAuthorDetails id="ref-1">
<strAuthorName id="ref-8">John Doe</strAuthorName>
</i7:getAuthorDetails>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
-----------------------------
Here is the Java Source
------------------------------
SOAPMappingRegistry smr = new
SOAPMappingRegistry ();
StringDeserializer sd = new
StringDeserializer ();
smr.mapTypes (Constants.NS_URI_SOAP_ENC,
new QName("", "__return"), null,
null, sd);
Call callSOAP = new Call();
SOAPHTTPConnection st = new
SOAPHTTPConnection();
callSOAP.setSOAPTransport(st);
callSOAP.setSOAPMappingRegistry(smr);
callSOAP.setTargetObjectURI("http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails.Author/Authordetails");
callSOAP.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
callSOAP.setMethodName(strMethodName);
callSOAP.setParams(vecMethodParams);
Response responseSOAP =
callSOAP.invoke(new
URL("http://localhost:9000/URN:Author"),
"http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails.Author/Authordetails#getAuthorDetails");
--------------------------------------
Here is the SDL file for the service :
--------------------------------------
<?xml version='1.0'?>
<serviceDescription name='Author'
targetNamespace='http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails/Authordetails'
xmlns='urn:schemas-xmlsoap-org:sdl.2000-01-25'>
<soap
xmlns='urn:schemas-xmlsoap-org:soap-sdl-2000-01-25'
xmlns:soap='urn:schemas-xmlsoap-org:soap.v1'
xmlns:ns2='http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails.Author/Authordetails'>
<service>
<requestResponse
name='getAuthorDetails'
soapAction='http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails.Author/Authordetails#getAuthorDetails'>
<request
ref='ns2:getAuthorDetails'/>
<response
ref='ns2:getAuthorDetailsResponse'/>
</requestResponse>
<addresses>
<address uri=''/>
</addresses>
</service>
<schema
targetNamespace='http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails/Authordetails'
xmlns='http://www.w3.org/1999/XMLSchema'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'
xmlns:xsi='http://www.w3.org/1999/XMLSchema/instance'
xmlns:suds='urn:schemas-xmlsoap-org:soap-sdl-2000-01-25'
xmlns:soap='urn:schemas-xmlsoap-org:soap.v1'
xmlns:ns1='http://Schemas.microsoft.com/urt/NS/System'
xmlns:ns2='http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails.Author/Authordetails'
xmlns:ns0='http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails/Authordetails'
elementFormDefault='unqualified'
attributeFormDefault='unqualified'>
</schema>
</soap>
<schema
targetNamespace='http://Schemas.microsoft.com/urt/NSAssem/AuthorDetails.Author/Authordetails'
xmlns='http://www.w3.org/1999/XMLSchema'
xmlns:xsd='http://www.w3.org/1999/XMLSchema'
xmlns:xsi='http://www.w3.org/1999/XMLSchema/instance'
xmlns:suds='urn:schemas-xmlsoap-org:soap-sdl-2000-01-25'
xmlns:soap='urn:schemas-xmlsoap-org:soap.v1'
xmlns:ns1='http://Schemas.microsoft.com/urt/NS/System'
elementFormDefault='unqualified'
attributeFormDefault='unqualified'>
<element name='getAuthorDetails'>
<complexType>
<all>
<element name='strAuthorName'
type='xsd:string'/>
</all>
</complexType>
</element>
<element name='getAuthorDetailsResponse'>
<complexType>
<all>
<element name='__return'
type='xsd:string'/>
</all>
</complexType>
</element>
</schema>
</serviceDescription>
-------------------------------------------------------
Any help will be greatly appreciated.
Thanks,
Rahul
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org