Elise, Why do you use the URL class instead of Call? I believe that you can connect to .NET using Call.
Scott Nichol ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 21, 2002 8:13 AM Subject: java client for .NET : need SOAPMapping sample code > hi, > i had a code, in the past, to marshall a java object into SOAP before to > send it to a java webservice. > Now, my java client calls a .NET webservice. > and the way i connect to the .NET webservice is different (i don't use > Call() class, i do use URL() class, just because taht's the only code i > know to connectto a .NET webservice) > the problem is that my SOAP code doesn't fit any more > > could you post me a sample code, with a connection to a .NETwebservice and > a SOAPMapping ? > regards, > > > Elise > > ======================================================= > Old java code > > Call call = new Call (); > call.setTargetObjectURI ("urn:liox:Project"); > call.setMethodName ("getProject"); > call.setEncodingStyleURI(encodingStyleURI); > SOAPMappingRegistry smr = new SOAPMappingRegistry(); > ProjectSerializer beanSer = new ProjectSerializer(); > StringDeserializer sd = new StringDeserializer (); > > > smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("urn:Projects", > "Project"), Project.class, beanSer, beanSer); > smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("", "return"), > Project.class, null, beanSer); > smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("", > "ProjectCode"), null, null, sd); > smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("", > "CompanyName"), null, null, sd); > > call.setSOAPMappingRegistry(smr); > > Response resp = call.invoke (url, "" ); > > ===================================================== > New java code > > > byte[] request = marshall(); > URL endpoint = new > URL("http://val1nt10/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 (); > //HERE SOAPMAPPING ???? HOW ??? it's not urn anymore true > ??? > out.write (request); > out.flush (); > out.close(); > > -------------------------------------------- > Elise Dupont > Software developer > Technology Development Group Europe > Lionbridge Technologies - France > Buropolis 1 - 1240 route des Dolines > 06560 Sophia-Antipolis > www.lionbridge.com