dcsimg
using Apache SOAP to call .NET services
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jennifer_Morgan
Posted On:   Thursday, June 27, 2002 01:04 PM

I have an Apache SOAP service that I am using as the client to invoke a .NET service. Everything seems to be working well but I have noticed that when a .NET client calls a .NET service the existing socket connection reused. However, when I use the APache SOAP service as the client it opens and closes a socket for every call. Why is this happening? Is there a way to make it reuse the existing socket connection? Thanks!

Re: using Apache SOAP to call .NET services

Posted By:   tyris_d  
Posted On:   Monday, July 15, 2002 01:14 AM

hi,

i can't answer to your question but i'd like to know if you succeded in something i failed :



i do have a .NET webservice and i call it for a java client.
i must send a complex type. i tryed many ways to generate the SOAP message but .NET doesn't recognize the message format. So for the moment i send an "hard coded" soap message... but i'd like to generate it.



did you succeed ?


regards,

Elise





here is a sample :





======================

here is the code that works : hard code




StringBuffer payload =
new StringBuffer("");
payload.append(
"");
payload.append("");
payload.append("");
payload.append("");
.......
URL endpoint = new URL(server + "/PCS_Integration/SynchronizeProfiles.asmx");
URLConnection con = endpoint.openConnection();
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setAllowUserInteraction(false);
con.setRequestProperty("Content-Length", Integer.toString(request.length));
con.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
con.setRequestProperty(
"SOAPAction",""http://tempuri.org/WS_UpdateProfileAgency"");
OutputStream out = con.getOutputStream();
out.write(request);
.......






======================

here is the SOAP message generation that doesn't work but should



SOAPMappingRegistry smr = new SOAPMappingRegistry ();
StringDeserializer sd = new StringDeserializer ();
smr.mapTypes(Constants.NS_URI_SOAP_ENC ,new QName("http://tempuri.org/","BonjourResult"),null,null,sd);

SOAPhttpConnection st = new SOAPhttpConnection();

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

call.setTargetObjectURI ("http://tempuri.org/");
call.setMethodName("Bonjour");
call.setEncodingStyleURI (Constants.NS_URI_SOAP_ENC);


Vector params = new Vector();
Parameter pTheByte = new Parameter("strName", String.class, "elise", null);
params.addElement(pTheByte);
call.setParams(params)
Response resp = null;
try {
resp = call.invoke (url, "http://tempuri.org/Bonjour");
.......






Here is the exact question i posted a few months ago :

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 followed each recomandations found on SOAP doc, mailing list archives and so on, but the problem is not solved : i get this error :


Caught SOAPException (SOAP-ENV:Client): No Deserializer found to deserialize a 'http://tempuri.org/:BonjourResult' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.


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 !

About | Sitemap | Contact