在IBM MobileFirst中调用SOAP适配器时出错

时间:2015-04-06 14:11:41

标签: soap ibm-mobilefirst mobilefirst-adapters

我创建了一个HTTP Adapter并尝试调用SOAP请求。但是我收到了以下错误:

{
   "errors": [
      "White spaces are required between publicId and systemId.",
      "Failed to parse the payload from backend (procedure: HttpRequest)"
   ],
   "info": [
   ],
   "isSuccessful": false,
   "responseHeaders": {
      "Content-Length": "1164",
      "Content-Type": "text\/html; charset=UTF-8",
      "Date": "Mon, 06 Apr 2015 22:16:54 GMT",
      "X-Powered-By": "Servlet\/2.5 JSP\/2.1"
   },
   "responseTime": 869,
   "statusCode": 404,
   "statusReason": "Not Found",
   "totalTime": 910,
   "warnings": [
   ]
}

我已经在SOAP UI中测试了请求并获得了正确的值。

**注意:此wsdl是从Oracle客户服务中心自动生成的。使用基本服务计费产品。 **

我在这里粘贴请求:http://9.113.129.21:7500/ouaf/XAIApp/xaiserver/CM_GETCURRENTBILL

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cm="http://oracle.com/CM_GETCURRENTBILL.xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <cm:CM_GETCURRENTBILL dateTimeTagFormat="xsd">
         <!--Optional:-->
         <cm:zone>CM-GETBILCNT</cm:zone>
         <!--Optional:-->
         <cm:accountId>?</cm:accountId>
         <!--Zero or more repetitions:-->
         <cm:results>
            <!--Optional:-->
            <cm:billId>?</cm:billId>
         </cm:results>
      </cm:CM_GETCURRENTBILL>
   </soapenv:Body>
</soapenv:Envelope>

从SOAP UI运行时,我需要提供我在Adapter.xml中提供的用户名和密码

<wl:adapter name="DemoHTTPwithAuthAdapter"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:wl="http://www.ibm.com/mfp/integration"
    xmlns:http="http://www.ibm.com/mfp/integration/http">

    <displayName>DemoHTTPwithAuthAdapter</displayName>
    <description>DemoHTTPwithAuthAdapter</description>
    <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>http</protocol>
            <domain>9.113.129.21</domain>
            <port>7500</port>   
            <connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds>
            <socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds>
            <authentication>
                <basic />
                <serverIdentity>
                    <username>TESTER</username>
                    <password>ibmindia#$</password>
                </serverIdentity>
            </authentication>
            <maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode>
            <!-- Following properties used by adapter's key manager for choosing specific certificate from key store  
            <sslCertificateAlias></sslCertificateAlias> 
            <sslCertificatePassword></sslCertificatePassword>
            -->     
        </connectionPolicy>
    </connectivity>
    <procedure name="CM_GETCURRENTBILLService"/>
</wl:adapter>

此处还有我的adpater-impl.js文件。

function CM_GETCURRENTBILLService(accountId) {

    var soapRequest = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cm="http://oracle.com/CM_GETCURRENTBILL.xsd">'
       +'<soapenv:Header/>'
       +'<soapenv:Body>'
          +'<cm:CM_GETCURRENTBILL dateTimeTagFormat="xsd">'
            + '<!--Optional:-->'
            +'<cm:zone>CM-GETBILCNT</cm:zone>'
             +'<!--Optional:-->'
             +'<cm:accountId>'+accountId+'</cm:accountId>'
             +'<!--Zero or more repetitions:-->'
             +'<cm:results>'
               +'<!--Optional:-->'
                +'<cm:billId></cm:billId>'
            +'</cm:results>'
          +'</cm:CM_GETCURRENTBILL>'
       +'</soapenv:Body>'
    +'</soapenv:Envelope>';

    var path="http://oracle.com/CM_GETCURRENTBILL.xsd";

    var input = {
        method : 'post',
        returnedContentType : 'xml',
        path : path,
        headers : {
            'SOAPAction' : 'http://oracle.com/CM_GETCURRENTBILL.xsd/CM_GETCURRENTBILL'
        },
        body : {
            content : soapRequest,
            contentType : 'text/xml; charset=utf-8'
        }
    };

    return WL.Server.invokeHttp(input);
}

2 个答案:

答案 0 :(得分:1)

确保您的路径正确无误。您的代码中包含var path="http://oracle.com/CM_GETCURRENTBILL.xsd";

这将转化为对http://9.113.129.21:7500/http://oracle.com/CM_GETCURRENTBILL.xsd

的请求

答案 1 :(得分:0)

肥皂行为似乎不正确。示例肥皂对OUAF生成的服务的操作类似于 - http://ouaf.oracle.com/spl/XAIXapp/xaiserver/ValidateMeterItemRequest