Results 1 to 4 of 4
  1. #1
    Alfred_O is offline Member
    Join Date
    May 2008
    Posts
    2
    Rep Power
    0

    Default How to send XML document from java client to .net webservice

    Greetings, I have implemented a Web service with .Net that receives a XML document as input parameter. I want to implement a java client that consumes the Web service (sending the XML document). The Wsdl of the web service uses "anyType" as the data type, and the java client uses "java.lang.object". I don't know how to send the XML document from the java client to the .Net Web Service. Any help will be appreciated, thanks in advance

  2. #2
    mtv134 is offline Member
    Join Date
    Aug 2008
    Posts
    22
    Rep Power
    0

    Default

    change the type in the wsdl into string and regenerate the webservice and the client and send the xml file as a string
    visit http://www.thejavacode.com
    Muhammad Safwat

  3. #3
    skaspersen is offline Member
    Join Date
    Jul 2008
    Posts
    31
    Rep Power
    0

    Default

    Is it any xml document or is it a specific xml document with a specific schema?

    If it has a known schema and you are actually using the contents of the xml file in your web service method you should change the parameter in the .net service to accept a type bound to the documents root element. This means unmarsheling the file in the java client before sending it. You can use XML Tools : DTD, XML schema and XML document conversion software tool : XML Utilities to create an XML Schema (xsd) to use with JAXB - XJC to generate object bindings.

    On the other hand if it is just a file change the parameter to:
    Java Code:
    <xs:element xmlns:ns1="http://www.w3.org/2005/05/xmlmime" name="parameterName" ns1:expectedContentTypes="application/xml" type="xs:base64Binary"></xs:element>
    If i remember correctly the Java object would translate to byte[], but see what jaxws comes up with.

    Once you have created your Port object in the java client do the following to enable MTOM
    Java Code:
    	BindingProvider bp = ((BindingProvider) port);
    	SOAPBinding sb = ((SOAPBinding) bp.getBinding());
    	sb.setMTOMEnabled(true);
    	bp.getRequestContext().put(JAXWSProperties.MTOM_THRESHOLOD_VALUE, Integer.valueOf(XX));
    XX is the size value at which binary data would be sent as a mime attachment. I usually set mine to 0.

    HTH
    Stephen

  4. #4
    simonkao is offline Member
    Join Date
    Jun 2010
    Posts
    1
    Rep Power
    0

    Default How to send XML files from Java Client to Web Services(wsdl)

    Hi Stephen,

    I have the same request to send xml files from Java client to WSDL.
    Do you have some sample Java code to do that ?
    Thanks,
    Simon
    email : simonkao2714@gmail.com

    >>Is it any xml document or is it a specific xml document with a specific schema?

    >>If it has a known schema and you are actually using the contents of the >>xml file in your web service method you should change the parameter in >>the .net service to accept a type bound to the documents root element. >>This means unmarsheling the file in the java client before sending it. You >>can use XML Tools : DTD, XML schema and XML document conversion >>software tool : XML Utilities to create an XML Schema (xsd) to use with >>JAXB - XJC to generate object bindings.

Similar Threads

  1. Axis Client accessing data on .Net webservice
    By cfacile666 in forum Web Frameworks
    Replies: 3
    Last Post: 09-02-2008, 11:35 AM
  2. Replies: 0
    Last Post: 05-18-2008, 08:24 PM
  3. How to set a max response time in webservice client
    By sudheerbasu.k@gmail.com in forum Advanced Java
    Replies: 1
    Last Post: 05-11-2008, 02:25 AM
  4. A Client to Send SMTP Mail
    By Java Tip in forum java.net
    Replies: 0
    Last Post: 04-07-2008, 08:06 PM
  5. Writing webservice client
    By javaplus in forum Web Frameworks
    Replies: 0
    Last Post: 12-19-2007, 10:10 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •