Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

java client for .NET WebService - interop problem in SOAP message

Status
Not open for further replies.

tyris

Programmer
Nov 2, 2000
311
FR
i read all SOAP documentation... in fact my question is more about interoperability...
I generated XML with the tool Castor (xml2java2xml data binding). when i hard code a SOAP message with the enveloppe and just add my XML in the body it works fine, i even sent complex types like datasets.

the problem is that when i generate the SOAP (with the code below) the SOAP message isn't like what is expecting .NET, (i read many documentation about xsd and co it's not the problem), i followed each recomandations found on SOAP doc, mailing list archives and so on, but the problem is not solved : i get this error :
Code:
Caught SOAPException (SOAP-ENV:Client): No Deserializer found to deserialize a '[URL unfurl="true"]http://tempuri.org/:BonjourResult'[/URL] using encoding style '[URL unfurl="true"]http://schemas.xmlsoap.org/soap/encoding/'.[/URL]

i tryed to change the encoding, but it's even worse, or in some cases there is no error but the .NET webservice doesn't understand my string and can't return it... my java to java webservices have always worked fine... but i was wondering if there is maybe a solution to generate a SOAP message that could be understandable by .NET
I guess that the solution could be in the marshaller, i read many do about it, but i'm not able to make it works !

ps : i will also post this question in a java forum, but if somewhee here also develop in java it could help me ?

======================
here is the code that works : hard code

Code:
		StringBuffer payload =
			new StringBuffer(&quot;<?xml version=\'1.0\' encoding=\'UTF-8\'?>&quot;);
		payload.append(
			&quot;<soap:Envelope xmlns:xsi=\&quot;[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance\&quot;[/URL] xmlns:xsd=\&quot;[URL unfurl="true"]http://www.w3.org/2001/XMLSchema\&quot;[/URL] xmlns:soap=\&quot;[URL unfurl="true"]http://schemas.xmlsoap.org/soap/envelope/\&quot;>&quot;);[/URL]
		payload.append(&quot;<soap:Body>&quot;);
		payload.append(&quot;<WS_UpdateProfileAgency xmlns=\&quot;[URL unfurl="true"]http://tempuri.org/\&quot;>&quot;);[/URL]
		payload.append(&quot;<dsComp>&quot;);
		.......
		URL endpoint = new URL(server + &quot;/PCS_Integration/SynchronizeProfiles.asmx&quot;);
		URLConnection con = endpoint.openConnection();
		con.setDoInput(true);
		con.setDoOutput(true);
		con.setUseCaches(false);
		con.setAllowUserInteraction(false);
		con.setRequestProperty(&quot;Content-Length&quot;, Integer.toString(request.length));
		con.setRequestProperty(&quot;Content-Type&quot;, &quot;text/xml; charset=utf-8&quot;);
		con.setRequestProperty(
		&quot;SOAPAction&quot;,&quot;\&quot;[URL unfurl="true"]http://tempuri.org/WS_UpdateProfileAgency\&quot;&quot;);[/URL]
		OutputStream out = con.getOutputStream();
		out.write(request);
		.......


======================
here is the SOAP message generation that doesn't work but should ;-)
Code:
		SOAPMappingRegistry smr = new SOAPMappingRegistry ();
		StringDeserializer sd = new StringDeserializer ();
		smr.mapTypes(Constants.NS_URI_SOAP_ENC ,new QName(&quot;[URL unfurl="true"]http://tempuri.org/&quot;,&quot;BonjourResult&quot;),null,null,sd);[/URL]

		SOAPHTTPConnection st = new SOAPHTTPConnection();

		Call call = new Call ();
		call.setSOAPTransport(st);
		call.setSOAPMappingRegistry (smr);

		call.setTargetObjectURI (&quot;[URL unfurl="true"]http://tempuri.org/&quot;);[/URL]
		call.setMethodName(&quot;Bonjour&quot;);
		call.setEncodingStyleURI (Constants.NS_URI_SOAP_ENC);


		Vector params = new Vector();
		Parameter pTheByte = new Parameter(&quot;strName&quot;, String.class, &quot;elise&quot;, null);
		params.addElement(pTheByte);
		call.setParams(params)
		Response resp = null;
		try {
		  resp = call.invoke (url, &quot;[URL unfurl="true"]http://tempuri.org/Bonjour&quot;);[/URL]
		.......
Best regards,
Elise, XML learning girl X-)
 
I think you forgot to specify:
Dim Soap as New Zest.Bar

Ha ha ha (sorry sorry, couldn't resist)

Honestly, I have no clue, this post is only for comedy relief. If I come accross anything, I'll let you know
:)

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top