UNCLASSIFIED////

I managed to get the types into the message using the ServiceClient, but
I cannot get the declared namespaces to show up. Here is my code if it
helps you out:
public Object invoke(String methodName, Object[] args) throws Exception
{
        String response = null;
        try {
                SOAPFactory omFactory =
OMAbstractFactory.getSOAP11Factory();
                SOAPEnvelope envelope = omFactory.getDefaultEnvelope();
        
envelope.declareNamespace("http://schemas.xmlsoap.org/soap/envelope/";,
"SOAP-ENV");
        
envelope.declareNamespace("http://schemas.xmlsoap.org/soap/encoding/";,
"SOAP-ENC");
        
envelope.declareNamespace("http://www.w3.org/2001/XMLSchema";, "xsd");
                OMNamespace nsXsi =
envelope.declareNamespace("http://www.w3.org/2001/XMLSchema-instance";,
"xsi");
                OMNamespace nsService =
envelope.declareNamespace("urn:ermservice", "ns1");

                OMFactory fac = OMAbstractFactory.getOMFactory();

                OMElement method = fac.createOMElement(methodName,
nsService);
                envelope.getBody().addChild(method);

                OMElement value = fac.createOMElement("user-String",
null);
                value.addChild(fac.createOMText(this.userName));
                value.addAttribute("type", "xsd:string", nsXsi);

                method.addChild(value);

                MessageContext msgContext = new MessageContext();
                msgContext.setEnvelope(envelope);       

                Options options = new Options();
                options.setTo(new EndpointReference(
this.url.toExternalForm() ));
        
options.setTransportInProtocol(org.apache.axis2.Constants.TRANSPORT_HTTP
);
                options.setProperty(HTTPConstants.CHUNKED, false);

                System.out.println(envelope.toString());//correctly
shows all declared namespaces
                ServiceClient sender = new ServiceClient();
                sender.setOptions(options);

                OMElement result = sender.sendReceive(method);
                response = result.getFirstElement().getText();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response;
}

-----Original Message-----
From: Tony Liu [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 10, 2008 12:09 AM
To: axis-user@ws.apache.org
Subject: How to retain type info in soap?

Hey,
Can anyone tell me how to retain type infomation of any value in an
incoming soap message in Axis2?
for example, instead of <name>abc</name>, we have <name
type="string">abc</name>.

cheers,

Tony


UNCLASSIFIED////


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to