}
public void testNamespacedDocWrappedServiceMessageAccess() throws Exception
{
MessageFactory msgFactory = MessageFactory.newInstance();
SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
String purchaseNamespace = "http://namespace/purchase";
String resultNamespace = "http://namespace/result";
String stringNamespace = "http://namespace/string";
String reqEnv =
"<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
" <env:Header/>" +
" <env:Body>" +
" <ns1:SubmitNamespacedPO xmlns:ns1='" + targetNS + "'>" +
" <ns2:NamespacedPurchaseOrder xmlns:ns2='" + purchaseNamespace + "'>Ferrari</ns2:NamespacedPurchaseOrder>" +
" <ns3:NamespacedString xmlns:ns3='" + stringNamespace + "'>message</ns3:NamespacedString>" +
" </ns1:SubmitNamespacedPO>" +
" </env:Body>" +
"</env:Envelope>";
SOAPMessage reqMsg = msgFactory.createMessage(null, new ByteArrayInputStream(reqEnv.getBytes()));
URL epURL = new URL("http://" + getServerHost() + ":8080/jaxws-samples-soapbinding/DocWrappedService");
SOAPMessage resMsg = con.call(reqMsg, epURL);
QName qname = new QName(targetNS, "SubmitNamespacedPOResponse");
SOAPElement soapElement = (SOAPElement)resMsg.getSOAPBody().getChildElements(qname).next();
soapElement = (SOAPElement)soapElement.getChildElements(new QName(resultNamespace, "NamespacedPurchaseOrderAck")).next();
assertEquals("Ferrari", soapElement.getValue());