WSO2 APIM 中的 SOAP 端点因空指针异常而失败
SOAP endpoint in WSO2 APIM fails with null pointer exception
我正在尝试将 SOAP API 添加到 APIM 1.10.0。
首先,我将尝试使用以下 CURL 测试 SOAP 服务本身。该服务应 return 给定 city/country 的天气条件:
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
我想这是正常现象。
问题是 - 为什么会出现空指针异常?
错误是由自定义身份验证插件处理程序引起的。
从处理程序链中删除此处理程序解决了问题。
我正在尝试将 SOAP API 添加到 APIM 1.10.0。
首先,我将尝试使用以下 CURL 测试 SOAP 服务本身。该服务应 return 给定 city/country 的天气条件:
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
我想这是正常现象。
问题是 - 为什么会出现空指针异常?
错误是由自定义身份验证插件处理程序引起的。 从处理程序链中删除此处理程序解决了问题。