我正在使用KSOAP2来使用SAP Web服务
这是成功请求和回复
请求
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:d="http://www.w3.org/2001/XMLSchema"
xmlns:c="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<urn:SdRfcCustomerGet xmlns:urn="urn:sap-com:document:sap:soap:functions:mc-style">
<CustomerT>
<item>
<Kunnr></Kunnr>
<Anred></Anred>
<Name1></Name1>
<Pfach></Pfach>
<Stras></Stras>
<Pstlz></Pstlz>
<Telf1></Telf1>
<Telfx></Telfx>
<Ort01></Ort01>
</item>
</CustomerT>
<Kunnr>0000491100</Kunnr>
<Name1></Name1>
</urn:SdRfcCustomerGet>
</v:Body>
</v:Envelope>
RESPONSE
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header/>
<soap-env:Body>
<n0:SdRfcCustomerGetResponse xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style">
<CustomerT>
<item>
<Kunnr>0000491100</Kunnr>
<Anred/>
<Name1>Customer Company 02</Name1>
<Pfach>127 353</Pfach>
<Stras>Sheikh Zayed Road</Stras>
<Pstlz/>
<Ort01>Berlin</Ort01>
<Telf1/>
<Telfx/>
</item>
</CustomerT>
</n0:SdRfcCustomerGetResponse>
</soap-env:Body>
</soap-env:Envelope>
这是我的Android代码生成的请求和响应
请求
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema"
xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<SdRfcCustomerGet xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
<CustomerT>
<item>
<Kunnr></Kunnr>
<Anred></Anred>
<Name1></Name1>
<Pfach></Pfach>
<Stras></Stras>
<Pstlz></Pstlz>
<Telf1></Telf1>
<Telfx></Telfx>
<Ort01></Ort01>
</item>
</CustomerT>
<Kunnr>0000491100</Kunnr>
<Name1></Name1>
</SdRfcCustomerGet>
</v:Body>
</v:Envelope>
RESPONSE
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header/>
<soap-env:Body>
<soap-env:Fault>
<faultcode>soap-env:Server</faultcode>
<faultstring xml:lang="en">Processing Error. More details in WS Error Log (transaction SRT_UTIL) by selection with UTC timestamp 20131202115430 </faultstring>
<detail/>
</soap-env:Fault>
</soap-env:Body>
</soap-env:Envelope>
eclipse中生成的错误
SoapFault - faultcode: 'soap-env:Server' faultstring: 'Processing Error. More details in WS Error Log (transaction SRT_UTIL) by selection with UTC timestamp 20131202115430 ' faultactor: 'null' detail: org.kxml2.kdom.Node@41c9e4a0
服务器上的错误
---- ERROR_TEXT Element 'CustomerT' missing
我需要在请求中更改的行是
<SdRfcCustomerGet xmlns="urn:sap-com:document:sap:soap:functions:mc-style">
我需要将其更改为(我想在函数名之前添加ns1或urn或n0)
<ns1:SdRfcCustomerGet xmlns:ns1='urn:sap-com:document:sap:soap:functions:mc-style'>
任何人都可以帮助我吗
我已经被困了一个星期了
答案 0 :(得分:0)
我设法解决了这个问题
SoapObject request = new SoapObject("", "urn:" + WS_METHOD_NAME);
request.addAttribute("xmlns:urn", WS_NAMESPACE);