You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Richard Bourland <re...@yahoo.com> on 2000/11/15 20:40:31 UTC

creating soap message with Apache API

Has anyone used the Apache soap API to create a soap
envelope?  I have attempted to use the header, body
and envelope classes to create a soap envelope and
send it to the router URL but have been encountering
errors. 

I have posted a similar message and the response was
to use the literal_xml URI.  This works, but I am
needing to generate a soap message with the
appropriate soap envelope.  I have been looking at the
examples and it looks as though to return any kind of
xml or soap I will need to create a Element object as
used in the AddressBook.java file.  Am I on the right
track?

Thanks in advance

Rich

__________________________________________________
Do You Yahoo!?
Yahoo! Calendar - Get organized for the holidays!
http://calendar.yahoo.com/

Re: creating soap message with Apache API

Posted by Robert Chartier <Ro...@LogiSoft-SCI.com>.
Hello Richard,

I am not sure if I understood your question correctly!  If you meant to get an XML soap envelope before sending it to the server here's how I do it.

    // Build the call.
    Call call = new Call ();
    call.setTargetObjectURI ("urn:AddressFetcher");
    call.setMethodName ("getAllListings");
    call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);

    // Build the envelope from the call object
    Envelope env = call.buildEnvelope();
    StringWriter req = new StringWriter ();
    env.marshall(req, new SOAPMappingRegistry());

    // now req contains an XML-SOAP envelope as string
    System.out.println(req);
    
    // If you want to send that envelope to a soap-rpc
    Hashtable headers = new Hashtable();
    headers.put (Constants.HEADER_SOAP_ACTION, "\"\"");
    HTTPUtils.Response resp = HTTPUtils.post(url, headers, Constants.HEADERVAL_CONTENT_TYPE,req.toString());

Regards,

Robert Chartier
LogiSoft
  ----- Original Message ----- 
  From: Richard Bourland 
  To: soap-user@xml.apache.org 
  Sent: Wednesday, November 15, 2000 2:40 PM
  Subject: creating soap message with Apache API


  Has anyone used the Apache soap API to create a soap
  envelope?  I have attempted to use the header, body
  and envelope classes to create a soap envelope and
  send it to the router URL but have been encountering
  errors. 

  I have posted a similar message and the response was
  to use the literal_xml URI.  This works, but I am
  needing to generate a soap message with the
  appropriate soap envelope.  I have been looking at the
  examples and it looks as though to return any kind of
  xml or soap I will need to create a Element object as
  used in the AddressBook.java file.  Am I on the right
  track?

  Thanks in advance

  Rich

  __________________________________________________
  Do You Yahoo!?
  Yahoo! Calendar - Get organized for the holidays!
  http://calendar.yahoo.com/


Re: creating soap message with Apache API

Posted by Robert Chartier <Ro...@LogiSoft-SCI.com>.
Hello Richard,

I am not sure if I understood your question correctly!  If you meant to get an XML soap envelope before sending it to the server here's how I do it.

    // Build the call.
    Call call = new Call ();
    call.setTargetObjectURI ("urn:AddressFetcher");
    call.setMethodName ("getAllListings");
    call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);

    // Build the envelope from the call object
    Envelope env = call.buildEnvelope();
    StringWriter req = new StringWriter ();
    env.marshall(req, new SOAPMappingRegistry());

    // now req contains an XML-SOAP envelope as string
    System.out.println(req);
    
    // If you want to send that envelope to a soap-rpc
    Hashtable headers = new Hashtable();
    headers.put (Constants.HEADER_SOAP_ACTION, "\"\"");
    HTTPUtils.Response resp = HTTPUtils.post(url, headers, Constants.HEADERVAL_CONTENT_TYPE,req.toString());

Regards,

Robert Chartier
LogiSoft
  ----- Original Message ----- 
  From: Richard Bourland 
  To: soap-user@xml.apache.org 
  Sent: Wednesday, November 15, 2000 2:40 PM
  Subject: creating soap message with Apache API


  Has anyone used the Apache soap API to create a soap
  envelope?  I have attempted to use the header, body
  and envelope classes to create a soap envelope and
  send it to the router URL but have been encountering
  errors. 

  I have posted a similar message and the response was
  to use the literal_xml URI.  This works, but I am
  needing to generate a soap message with the
  appropriate soap envelope.  I have been looking at the
  examples and it looks as though to return any kind of
  xml or soap I will need to create a Element object as
  used in the AddressBook.java file.  Am I on the right
  track?

  Thanks in advance

  Rich

  __________________________________________________
  Do You Yahoo!?
  Yahoo! Calendar - Get organized for the holidays!
  http://calendar.yahoo.com/