Objective-C SOAP Client --Request Problem?

梦想与她 提交于 2019-11-30 10:31:53
Tim Dean

Based on comparing this request to what you have in your question posted about a manual solution, it looks like you've got namespace issues happening here. The SOAP request generated here applies the http://org/ namespace (via the identifier CatalogoSvc) to the "name" element:

<CatalogoSvc:hello>
  <CatalogoSvc:name>David</CatalogoSvc:name>
</CatalogoSvc:hello>

In the manual scenario where you have gotten this to work, the http://org/ namespace is applied to the surrounding "hello" element but not the "name" element:

<ns2:hello xmlns:ns2="http://org/>
    <name>david</name>
</ns2:hello>

Based on this observation, I would deduce that your service is not expecting a namespace to be applied to the name element, so it is not finding that parameter when it is sent with a namespace.

To fix this problem you will need to either:

  1. Figure out how to tell the SOAP client stub generation to NOT apply a namespace to your parameter, or
  2. Update your service to make it expect a namespaced "name" element.

Since the client side code is presumably generated from the service's WSDL, I suspect that the Objective-C code is doing it right and your service code has it wrong, but that's just a suspicion. Either way, you need to find a way to make client and server side "agree"

i had same problem until suggestion at below...

According to what you've shown from your console, the XML request you formulated is invalid. You have

<ns2:hello xmlns:ns2="http://org/" />
    <name>david</name>
</ns2:hello>

But you should have (note the removal of the invalid XML tag termination):

<ns2:hello xmlns:ns2="http://org/>
    <name>david</name>
</ns2:hello>

Also note that your working sample request includes a soap:Header element, and yours does not. That is unlikely to be the problem here though.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!