how to send xml-document to webservice


XML & Web services: how to send xml-document to webservice

  1. how to send xml-document to webservice (7 messages)

    I hava a xml instance that schema is acording with wsdl message difition,can I send this xml document to webservice directly by jax-rpc?It seems that I must transfer xml-doucment to object,then pass the object to javax.xml.rpc.Call.invoke(Object[] parameters).
    thanks in advance

    Threaded Messages (7)

  2. how to send xml-document to webservice[ Go to top ]

    Try passing the XML document as a String to your web service. Provided that the XML is not huge, that should work.

    When the String is received by the service, you can then use DOM or SAX is parse the XML string.
  3. :)[ Go to top ]

    The web service provided by my parter can not be accessed via passing string!
  4. :)[ Go to top ]

    Sure it can. Open an HTTP connection to the endpoint of the service, get the output stream, and then send a string of XML that the service expects. Why wouldnt that work?
  5. :)[ Go to top ]

    OK. I think I misunderstood your original question.

    Correct me if I am wrong, but what you want to do is manually invoke your target web service, formatting the XML yourself rather than having JAX-RPC generate the XML from your objects.

    So far as I know, JAX-RPC does not really support this. However, you can always manually generate the entire SOAP message yourself, open up a raw TCP/IP socket [using] and send this content directly. If you do this, you will need to parse the XML in the SOAP response manually.

    This is easier than it sounds (I've done it), but is not particularly easy to maintain. You are probably better off creating an object model and moving your data using normal JAX-RPC.
  6. :)[ Go to top ]

    Thank Paul Strack .
      So far as I know,Apache soap,Axis do not support this,but it is useful to MANAGE wsdl message directly.why can I not accees web service if I have not a appropriate class.why can I not operate wsdl message such as updating message content if I hava not a instance that instantiate by some classes.
  7. :)[ Go to top ]

    The reason the toolkits encourage you to use objects (rather than XML) is that this reduces errors. Allowing the developer to insert arbitrary XML strings into the SOAP message means that the toolkit has to do a lot of extra work to ensure that the XML string is well formed and does not violate the SOAP specs.
  8. (^0^)[ Go to top ]

    It is terrific If apache provide a tool that make use of wsdl message to access web service directly.
    I think that this tool must hava the following features:

    1) manage wsdl ,especially,wsdl message.for example,MessageManger.replace(MessageID,id,WSDLMessage msg),MessageManger.find(String xpah)
    2) access webservice directly.for example, SoapCall.invoke(WSDLMessage[] msgs)
    3) transform WSDL Message to object if necessary.
       for example:
       TypeMapping.register(QName qn,Class c)
       Oder o = (Order)Transform.parse(WSDLMessage orderMessage)
       orderMessage = Transform.format(o)