Well... I found it in an earlier version of the "axis.jar"...Seems as if it
has gone in the beta3 release...

/s


-----Ursprungligt meddelande-----
Fr�n: Stefan Carlsson [mailto:[EMAIL PROTECTED]]
Skickat: den 19 juli 2002 12:24
Till: JDJList
�mne: [jdjlist] ServiceClient from apache-axis


Hi all !

I'm looking into apache's axis (build -on to SOAP). In a reference material
I
found an instantiation of a "org.apache.axis.client.ServiceClient". But I
can't
that class anywhere in the "axis.jar" . Does anyone have any experience with
ths way of invoking a client loke the  following ?:

import java.io.InputStream;
import java.io.StringWriter;
import org.apache.axis.Message;
import org.apache.axis.MessageContext;
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPBodyElement;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.client.ServiceClient;

/**
 * Purchase order submission client
 */
public class POSubmissionClient {
    /**
     * Target service URL
     */
    String url;
    
    /**
     * Create a client with a target URL
     */
    public POSubmissionClient(String url) {
        this.url = url;
    }
    
    /**
     * Invoke the PO submission web service
     *
     * @param po Purchase order document
     * @return Invoice document
     * @exception Exception I/O error or Axis error
     */
    public String invoke(InputStream po) throws Exception {
        // Send the message
        ServiceClient client = new ServiceClient(url);
        client.setRequestMessage(new Message(po, true));
        client.getMessageContext().
               setTargetService("http://www.skatestown.com/ns/po";);
        client.invoke();
        
        // Retrieve the response body
        MessageContext ctx = client.getMessageContext();
        Message outMsg = ctx.getResponseMessage();
        SOAPEnvelope envelope = outMsg.getAsSOAPEnvelope();
        SOAPBodyElement body = envelope.getFirstBody();
        
        // Get the XML from the body
        StringWriter w = new StringWriter();
        SerializationContext sc = new SerializationContext(w, ctx);
        body.output(sc);
        return w.toString();
    }
}



Thankfull for any help !
/s

To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to