如何将对象作为BlackBerry SOAP请求参数传递

时间:2014-06-03 05:50:04

标签: web-services soap blackberry request

我是使用Momentics进行BlackBerry开发的新手。现在我想将一个对象发送到SOAP请求。

这是我的网络服务:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Login xmlns="http://shidhints.com/">
      <MyLoginCredentials>
        <Email>string</Email>
        <Password>string</Password>
      </MyLoginCredentials>
    </Login>
  </soap:Body>
</soap:Envelope>

这是我的C ++代码:

m_soap.setAction("http://shidhints.com/Login");
m_soap.setHost("mobile.shidhints.com");

QtSoapMessage request;
request.setMethod(QtSoapQName("Login", "http://shidhints.com/"));

request.addMethodArgument("Email", "http://shidhints.com/", email);
request.addMethodArgument("Password", "http://shidhints.com/", password);

// Submit the method request to the web service.
m_soap.submitRequest(request, "http://shidhints.com/Service.asmx");

现在我收到的错误如下:

  

查询失败:XML解析错误

1 个答案:

答案 0 :(得分:0)

我已经使用代码解决了它,

QtSoapStruct *myStruct=new QtSoapStruct(QtSoapQName("MyLoginCredentials"));
myStruct->insert( new QtSoapSimpleType(QtSoapQName("Email"), email));
myStruct->insert( new QtSoapSimpleType(QtSoapQName("Password"),password));

request.addMethodArgument(myStruct);