WSO2 APIM中的SOAP端点失败,空指针异常

时间:2016-01-17 15:09:21

标签: soap nullpointerexception wso2

我正在尝试将SOAP API添加到APIM 1.10.0。

首先,我将尝试使用以下CURL测试SOAP服务本身。该服务应返回给定城市/国家的天气状况:

curl -X POST -T soap.xml -H "Content-Type: text/xml"  \
      "http://www.webservicex.net/globalweather.asmx"

提供以下soap.xml:

<?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>
    <GetWeather xmlns="http://www.webserviceX.NET">
        <CityName>Eilat</CityName>
        <CountryName>Israel</CountryName>
    </GetWeather>
</soap:Body>
</soap:Envelope>

我得到了明智的回应!

现在我将此服务介绍给APIM,如下所示:

- Add new API
- I have a SOAP endpoint
    - WSDL URL: http://www.webservicex.net/globalweather.asmx?wsdl
    - Start Creating
        - Name: eilat
        - Context: /eilat
        - Version: 1.0.0
        - WSDL: http://www.webservicex.net/globalweather.asmx?wsdl  [tested ok]
        - Production Endpoint: http://www.webservicex.net/globalweather.asmx [valid]
        - Tier Availability: Unlimited

我订阅此API,并尝试以下CURL

curl -H "Authorization: Bearer <my-key>" -X POST -T soap.xml \
     -H "Content-Type: text/xml" http://localhost:8280/eilat/1.0.0

我收到以下回复:

<faultstring>unknown</faultstring>

在SOAP UI中尝试相同的操作,我得到:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server</faultcode>
         <faultstring>unknown</faultstring>
         <detail/>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

#status#:HTTP 1.1 / 500内部服务器错误

查看日志:

1)http_access_2016-01-17.log

127.0.0.1 - - [17/Jan/2016:16:53:34 +0200] 
         "POST /eilat/1.0.0 HTTP/1.1" - 482 "-" 
         "curl/7.19.7 (x86_64-redhat-linux-gnu) 
         libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2"

2)wso2-apigw-errors.log

2016-01-17 16:53:34,364 [-] [PassThroughMessageProcessor-374] 
    ERROR ServerWorker Error processing 
        POST reguest for : 
           /eilat/1.0.0. Error detail: null. java.lang.NullPointerException

3)wso2carbon.log

   INFO {org.apache.synapse.rest.API} -  
        Initializing API: admin--eilat:v1.0.0 {org.apache.synapse.rest.API}
   INFO {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil} - 
        'admin@carbon.super [-1234]' logged in at [2016-01-17 16:52:51,282+0200] 
        {org.wso2.carbon.core.services.util.CarbonAuthenticationUtil}
   ERROR {org.apache.synapse.transport.passthru.ServerWorker} -  
        Error processing POST reguest for : /eilat/1.0.0. 
        Error detail: null.  
        {org.apache.synapse.transport.passthru.ServerWorker}
        java.lang.NullPointerException

再次查看API,我看到WSDL URL已从我提供的URL更改为以下内容:

/registry/resource/_system/governance/apimgt/applicationdata/wsdls/admin--eilat1.0.0.wsdl

我想这是正常行为。

问题是 - 为什么空指针异常?

1 个答案:

答案 0 :(得分:0)

错误是由于自定义身份验证插件处理程序引起的。 从处理程序链中删除此处理程序解决了这个问题。