wso2wso2-api-managerwso2-aswso2-esb

Connect between WSO2 ESB and AM


I wanted to connect WSO2 ESB's Health Care Proxy Sample to API Manager. But i failed to connect two products.


  1. I installed 3 WSO2 product(APIM, ESB and AS) in one local machine(Windows 7 64bit, java7) and gave different offset per product (APIM is 2, AS is 1 and ESB is 0).

  1. I run AS Server and uploaded 3 aar file (geows-SNAPSHOT.aar, hcfacilitylocator-SNAPSHOT.aar, hcinformationservice-SNAPSHOT.aar) on AS. (Downloaded from http://wso2.com/files/Service_Integration_Artifacts.zip)

  1. I run ESB Server and uploaded 1 car file (Service_Integration_CApp_1.0.0.car) on ESB. (Downloaded from http://wso2.com/files/Service_Integration_Artifacts.zip)

4.1 When i try using POSTMAN of chrome browser, it succeed like following.

URL is

http://localhost:8280/services/HCCProxyService

Method is

GET

I added two Header

SOAPAction

SOAPMessage

SOAPAction's value is getHealthcareCenterInfo

SOAPMessage's value is <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:heal="http://healthcare.wso2"><soapenv:Header></soapenv:Header><soapenv:Body><heal:getHealthcareCenterInfo><!--Optional:--><heal:longitude>3</heal:longitude><!--Optional:--><heal:latitude>4</heal:latitude></heal:getHealthcareCenterInfo></soapenv:Body> </soapenv:Envelope>

I got following response

<ns:getHCCenterInfoResponse 
xmlns:ns="http://healthcare.wso2">
<ns:return 
    xmlns:ax2460="http://healthcare.wso2/xsd" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax2460:HCInfo">
    <ax2460:address>2285 North Central Avenue</ax2460:address>
    <ax2460:approxDistance>1.5</ax2460:approxDistance>
    <ax2460:city>Kissimmee,  FL</ax2460:city>
    <ax2460:hcCenterName>QKissimmee CBOC</ax2460:hcCenterName>
    <ax2460:phone>407-518-5004</ax2460:phone>
</ns:return>


  1. I added following config on axis2.xml file

    <parameter name="HostnameVerifier">AllowAll</parameter>

and run AM Server and added this service on AM's publisher site through following step. 5.1 In design step Context name is

test

URL Pattern is test

selected two method is

GET, OPTIONS


5.2 In Implementation step

Endpoint type is

WSDL Endpoint

Production WSDL is

http://localhost:8280/services/HCCProxyService?wsdl

Service is

HCCProxyService

Port is

HCCProxyServiceHttpsSoap11Endpoint


5.3 In Manage step

Tier Availability is

Bronze,Gold,Silver,Unlimited

Transport is

HTTP, HTTPS


5.4 Save & Publish


  1. I subscribed this service on AM's store site and generated accesstoken.

  1. I try using POSTMAN of chrome browser with following settings

URL is

http://172.21.100.172:8282/test/1.0.0/test

Method is

GET

I added two Header

SOAPAction

SOAPMessage

SOAPAction's value is getHealthcareCenterInfo

SOAPMessage's value is <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:heal="http://healthcare.wso2"><soapenv:Header></soapenv:Header><soapenv:Body><heal:getHealthcareCenterInfo><!--Optional:--><heal:longitude>3</heal:longitude><!--Optional:--><heal:latitude>4</heal:latitude></heal:getHealthcareCenterInfo></soapenv:Body> </soapenv:Envelope>

Authorization is

Bearer 9970836add803ff1184d985bbb59669

Content-type is

application/xml;charset=UTF-8

  1. Finally, i just got following messages in chrome browser

    202 Accepted

ESB log is following.

[2015-02-11 15:07:48,691] DEBUG - wire >> "POST /services/HCCProxyService.HCCProxyServiceHttpsSoap11Endpoint HTTP/1.1[\r][\n]"
[2015-02-11 15:07:48,692] DEBUG - wire >> "Accept-Language: ko,en;q=0.8,ja;q=0.6,en-US;q=0.4[\r][\n]"
[2015-02-11 15:07:48,692] DEBUG - wire >> "Cookie: JSESSIONID=939D5BC8522D01F309A237606C5F343F[\r][\n]"
[2015-02-11 15:07:48,692] DEBUG - wire >> "Accept-Encoding: gzip, deflate, sdch[\r][\n]"
[2015-02-11 15:07:48,692] DEBUG - wire >> "SOAPMessage: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:heal="http://healthcare.wso2">    <soapenv:Header></soapenv:He
ader>    <soapenv:Body>       <heal:getHealthcareCenterInfo>          <!--Optional:-->          <heal:longitude>3</heal:longitude>          <!--Optional:-->          <heal:latitude>4</heal:latitude>
     </heal:getHealthcareCenterInfo>    </soapenv:Body> </soapenv:Envelope>[\r][\n]"
[2015-02-11 15:07:48,692] DEBUG - wire >> "Content-Type: text/xml[\r][\n]"
[2015-02-11 15:07:48,693] DEBUG - wire >> "Accept: application/xml[\r][\n]"
[2015-02-11 15:07:48,693] DEBUG - wire >> "Cache-Control: no-cache[\r][\n]"
[2015-02-11 15:07:48,694] DEBUG - wire >> "SOAPAction: "getHealthcareCenterInfo"[\r][\n]"
[2015-02-11 15:07:48,694] DEBUG - wire >> "Host: jonghwa79lee2:8243[\r][\n]"
[2015-02-11 15:07:48,694] DEBUG - wire >> "Connection: Keep-Alive[\r][\n]"
[2015-02-11 15:07:48,694] DEBUG - wire >> "User-Agent: Synapse-PT-HttpComponents-NIO[\r][\n]"
[2015-02-11 15:07:48,694] DEBUG - wire >> "[\r][\n]"
[2015-02-11 15:07:48,695] DEBUG - headers http-incoming-18 >> POST /services/HCCProxyService.HCCProxyServiceHttpsSoap11Endpoint HTTP/1.1
[2015-02-11 15:07:48,695] DEBUG - headers http-incoming-18 >> Accept-Language: ko,en;q=0.8,ja;q=0.6,en-US;q=0.4
[2015-02-11 15:07:48,696] DEBUG - headers http-incoming-18 >> Cookie: JSESSIONID=939D5BC8522D01F309A237606C5F343F
[2015-02-11 15:07:48,696] DEBUG - headers http-incoming-18 >> Accept-Encoding: gzip, deflate, sdch
[2015-02-11 15:07:48,696] DEBUG - headers http-incoming-18 >> SOAPMessage: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:heal="http://healthcare.wso2">    <soapenv:
Header></soapenv:Header>    <soapenv:Body>       <heal:getHealthcareCenterInfo>          <!--Optional:-->          <heal:longitude>3</heal:longitude>          <!--Optional:-->          <heal:latitude>
4</heal:latitude>       </heal:getHealthcareCenterInfo>    </soapenv:Body> </soapenv:Envelope>
[2015-02-11 15:07:48,697] DEBUG - headers http-incoming-18 >> Content-Type: text/xml
[2015-02-11 15:07:48,697] DEBUG - headers http-incoming-18 >> Accept: application/xml
[2015-02-11 15:07:48,697] DEBUG - headers http-incoming-18 >> Cache-Control: no-cache
[2015-02-11 15:07:48,698] DEBUG - headers http-incoming-18 >> SOAPAction: "getHealthcareCenterInfo"
[2015-02-11 15:07:48,698] DEBUG - headers http-incoming-18 >> Host: jonghwa79lee2:8243
[2015-02-11 15:07:48,698] DEBUG - headers http-incoming-18 >> Connection: Keep-Alive
[2015-02-11 15:07:48,698] DEBUG - headers http-incoming-18 >> User-Agent: Synapse-PT-HttpComponents-NIO
[2015-02-11 15:07:48,709] ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: ?덇린移??딆? ?뚯씪???앹엯?덈떎.
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
    at org.apache.axiom.om.impl.AbstractOMMetaFactory.createStAXSOAPModelBuilder(AbstractOMMetaFactory.java:73)
    at org.apache.axiom.om.impl.AbstractOMMetaFactory.createSOAPModelBuilder(AbstractOMMetaFactory.java:79)
    at org.apache.axiom.om.OMXMLBuilderFactory.createSOAPModelBuilder(OMXMLBuilderFactory.java:196)
    at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:55)
    at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:118)
    at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:107)
    at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:82)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:68)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
    at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: ?덇린移??딆? ?뚯씪???앹엯?덈떎.
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:598)
    at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
    at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)
    at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
    at org.apache.axiom.util.stax.dialect.SJSXPStreamReaderWrapper.next(SJSXPStreamReaderWrapper.java:138)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
    ... 20 more
[2015-02-11 15:07:48,731] ERROR - SequenceMediator Error while building message
org.apache.axis2.AxisFault: Error while building Passthrough stream
    at org.apache.synapse.transport.passthru.util.RelayUtils.handleException(RelayUtils.java:236)
    at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:111)
    at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:82)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:68)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
    at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411)
    at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: ?덇린移??딆? ?뚯씪???앹엯?덈떎.
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
    at org.apache.axiom.om.impl.AbstractOMMetaFactory.createStAXSOAPModelBuilder(AbstractOMMetaFactory.java:73)
    at org.apache.axiom.om.impl.AbstractOMMetaFactory.createSOAPModelBuilder(AbstractOMMetaFactory.java:79)
    at org.apache.axiom.om.OMXMLBuilderFactory.createSOAPModelBuilder(OMXMLBuilderFactory.java:196)
    at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:55)
    at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:118)
    at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:107)
    ... 12 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: ?덇린移??딆? ?뚯씪???앹엯?덈떎.
    at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:598)
    at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
    at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)
    at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
    at org.apache.axiom.util.stax.dialect.SJSXPStreamReaderWrapper.next(SJSXPStreamReaderWrapper.java:138)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
    ... 20 more
[2015-02-11 15:07:48,737] DEBUG - headers http-incoming-18 << HTTP/1.1 202 Accepted
[2015-02-11 15:07:48,737] DEBUG - headers http-incoming-18 << Date: Wed, 11 Feb 2015 06:07:48 GMT
[2015-02-11 15:07:48,737] DEBUG - headers http-incoming-18 << Server: WSO2-PassThrough-HTTP
[2015-02-11 15:07:48,737] DEBUG - headers http-incoming-18 << Transfer-Encoding: chunked
[2015-02-11 15:07:48,738] DEBUG - headers http-incoming-18 << Connection: Keep-Alive
[2015-02-11 15:07:48,738] DEBUG - wire << "HTTP/1.1 202 Accepted[\r][\n]"
[2015-02-11 15:07:48,738] DEBUG - wire << "Date: Wed, 11 Feb 2015 06:07:48 GMT[\r][\n]"
[2015-02-11 15:07:48,738] DEBUG - wire << "Server: WSO2-PassThrough-HTTP[\r][\n]"
[2015-02-11 15:07:48,739] DEBUG - wire << "Transfer-Encoding: chunked[\r][\n]"
[2015-02-11 15:07:48,739] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
[2015-02-11 15:07:48,739] DEBUG - wire << "[\r][\n]"
[2015-02-11 15:07:48,740] DEBUG - wire << "0[\r][\n]"
[2015-02-11 15:07:48,740] DEBUG - wire << "[\r][\n]"

  1. Direct call to ESB is successful, but using AM is failed. What i have to do??? I want to get following response using apim (Not a 202 Accepted Message)

I wanna following response

<ns:getHCCenterInfoResponse 
xmlns:ns="http://healthcare.wso2">
<ns:return 
    xmlns:ax2460="http://healthcare.wso2/xsd" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ax2460:HCInfo">
    <ax2460:address>2285 North Central Avenue</ax2460:address>
    <ax2460:approxDistance>1.5</ax2460:approxDistance>
    <ax2460:city>Kissimmee,  FL</ax2460:city>
    <ax2460:hcCenterName>QKissimmee CBOC</ax2460:hcCenterName>
    <ax2460:phone>407-518-5004</ax2460:phone>
</ns:return>


Solution

  • It was my mistake. In step 5.2, i modified as following and it works!!!

    5.2 In Implementation step

    Endpoint type is

    HTTP Endpoint
    

    Production WSDL is

    http://localhost:8280/services/HCCProxyService?wsdl