You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Scott Nichol <sc...@yahoo.com> on 2002/03/05 05:23:18 UTC

Re: java client for .NET : need SOAPMapping sample code

Elise,

I have not seen anything posted from you in a while.  Have you resolved
everything?

Scott Nichol

  ----- Original Message -----
  From: Elise_Dupont@lionbridge.com
  To: soap-dev@xml.apache.org
  Sent: Thursday, February 21, 2002 6:43 PM
  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



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com