UNCLASSIFIED////

I am having an issue using the ServiceClient to consume an old RPC soap
service. The namespace declarations seem to be lost when the soap
message is sent.
Here is a quick snippet of the code I using:

                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");

        ....
            OMElement value = fac.createOMElement("user-String", null);
            value.addChild(fac.createOMText(this.userName));
            value.addAttribute("type", "xsd:string", nsXsi);
        ....
                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());
            ServiceClient sender = new ServiceClient();
            sender.setOptions(options);
            
            OMElement result = sender.sendReceive(method);


Here is what the envelope.toString(and I believe exactly what I need):
        <?xml version='1.0' encoding='utf-8'?>
        <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
        
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"; 
        
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
                                xmlns:ns1="urn:ermservice" 
        
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
        
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
        <soapenv:Body>
                <ns1:cancel>
                        <user-String
xsi:type="xsd:string">user</user-String>
                        <param0-java.lang.String
xsi:type="xsd:string">data</param0-java.lang.String>
                </ns1:cancel>
        </soapenv:Body>
        </soapenv:Envelope>

But when I intercept the soap message it looks like:
        <?xml version="1.0" encoding="UTF-8"?>
        <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
        <soapenv:Body>
                <ns1:cancel xmlns:ns1="urn:ermservice">
                        <user-String
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:type="xsd:string">user</user-String>
                        <param0-java.lang.String
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:type="xsd:string">data</param0-java.lang.String>
                </ns1:cancel>
        </soapenv:Body>
        </soapenv:Envelope>


All the namespaces I have declared are missing or relocated so I am
getting back an error:
        <faultstring>Unable to resolve namespace URI for
'xsd'.</faultstring>

Can someone tell me how to get the XSD namespace to stick in the soap
message?
UNCLASSIFIED////


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

Reply via email to