Serviceclient problem invoking operations which have extended classes as parameters
I have operation input that have exteded class xsd:shema
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory(); SOAPEnvelope envelope = fac.getDefaultEnvelope(); OMNamespace omNs =开发者_如何学Python fac.createOMNamespace( "http://impl.service.mobile.boerse.com/", "impl"); // // creating the payload OMElement method = fac.createOMElement("getIndexData", omNs); OMElement value = fac.createOMElement("arg0.deviceType", omNs); value.setText("1"); method.addChild(value); OMElement value2 = fac.createOMElement("arg0.identificationID", omNs); value2.setText("1"); method.addChild(value2); OMElement value4 = fac.createOMElement("arg0.name", omNs); value4.setText("1"); method.addChild(value4); OMElement value3 = fac.createOMElement("arg1", omNs); value3.setText("1"); method.addChild(value3); envelope.getBody().addChild(method);
where is wrong
if you have extended class parementer such as operationname.anotherclass.paremeter
at first create anotherclass OMElement after create paremeter OMElement and add paremeter anatherclass
I solved the problem:
SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope envelope = fac.getDefaultEnvelope();
OMNamespace omNs = fac.createOMNamespace("http://impl.service.mobile.boerse.com/", "tns");
// // creating the payload
OMElement method = fac.createOMElement("getIndexData", omNs);
OMElement arg0 = fac.createOMElement(new QName("arg0"));
OMElement value = fac.createOMElement(new QName("deviceType"));
value.setText("1");
arg0.addChild(value);
OMElement value2 = fac.createOMElement(new QName("identificationID"));
value2.setText("1");
arg0.addChild(value2);
OMElement value4 = fac.createOMElement(new QName("name"));
value4.setText("1");
arg0.addChild(value4);
OMElement arg1 = fac.createOMElement(new QName("arg1"));
arg1.setText("1");
method.addChild(arg0);
method.addChild(arg1);
envelope.getBody().addChild(method);
return envelope;
精彩评论