SAP Web サービスに接続する必要があります。ここに私のコードがありますが、それは警告します:
org.xmlpull.v1.XmlPullParserException: 予想: START_TAG { http://schemas.xmlsoap.org/soap/envelope/ }エンベロープ (位置:START_TAG @1:7 in java.io.InputStreamReader@40e3fe98)
ユーザー名とパスワードで接続するための完全なコードを次に示します。
final static String NAMESPACE = "urn:sap-com:document:sap:soap:functions:mc-style";
final static String METHOD_NAME = "ZmblHucremalzemelistesi";
final static String SOAP_ACTION = "";
final static String URL = "http://xxx.xxx.xxx.xxx:1080/sap/bc/srt/wsdl/bndg_4F969242EA785040E10080008D0B0B03/wsdl11/allinone/ws_policy/document?sap-client=010";
private void testWS() {
// TODO Auto-generated method stub
SoapObject reSoapObject = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope soaSerializationEnvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
reSoapObject.addProperty("ILgort", "H12");
soaSerializationEnvelope.setOutputSoapObject(reSoapObject);
soaSerializationEnvelope.headerOut = new Element[1];
soaSerializationEnvelope.headerOut[0] = buildAuthHeader();
HttpTransportSE httpTransportSE = new HttpTransportSE(URL);
try {
httpTransportSE.call(SOAP_ACTION, soaSerializationEnvelope);
Object response = soaSerializationEnvelope.getResponse();
tv.setText(response.toString());
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
}
private Element buildAuthHeader() {
Element h = new Element().createElement(NAMESPACE, "AuthHeader");
Element username = new Element().createElement(NAMESPACE, "user");
username.addChild(Node.TEXT, "testuser");
h.addChild(Node.ELEMENT, username);
Element pass = new Element().createElement(NAMESPACE, "pass");
pass.addChild(Node.TEXT, "testpwd");
h.addChild(Node.ELEMENT, pass);
return h;
}