连接WSO2 ESB和AM

时间:2015-02-11 06:20:49

标签: wso2 wso2esb wso2-am wso2as

我想将WSO2 ESB的医疗保健代理示例连接到API Manager。 但我没能连接两个产品。


  1. 我在一台本地计算机(Windows 7 64位,java7)中安装了3个WSO2产品(APIM,ESB和AS),并为每个产品提供了不同的偏移量(APIM为2,AS为1,ESB为0)。

    1. 我在AS上运行AS Server并上传了3个aar文件(geows-SNAPSHOT.aar,hcfacilitylocator-SNAPSHOT.aar,hcinformationservice-SNAPSHOT.aar)。 (从http://wso2.com/files/Service_Integration_Artifacts.zip下载)

      1. 我在ESB上运行ESB Server并上传了1个汽车文件(Service_Integration_CApp_1.0.0.car)。 (从http://wso2.com/files/Service_Integration_Artifacts.zip下载)

      2. 4.1当我尝试使用Chrome浏览器的POSTMAN时,它会成功跟随。

        网址

        http://localhost:8280/services/HCCProxyService
        

        方法是

        GET
        

        我添加了两个Header

        SOAPAction
        
        SOAPMessage
        

        SOAPAction的价值是     getHealthcareCenterInfo

        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>

        我收到了以下回复

        <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. 我在axis2.xml文件中添加了以下配置

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

        2. 并运行AM Server并通过以下步骤在AM的发布商网站上添加此服务。 5.1在设计步骤中 上下文名称是

          test

          网址格式是 test

          选择两种方法是

          GETOPTIONS


          5.2在实施步骤

          端点类型是

          WSDL Endpoint

          生产WSDL

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

          服务

          HCCProxyService

          港口

          HCCProxyServiceHttpsSoap11Endpoint


          5.3在管理步骤

          Tier Availability

          BronzeGoldSilverUnlimited

          运输

          HTTPHTTPS


          5.4 Save&amp;发布


          1. 我在AM的商店网站上订阅了这项服务并生成了accessstoken。

            1. 我尝试使用带有以下设置的Chrome浏览器的POSTMAN
            2. 网址

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

              方法是

              GET
              

              我添加了两个Header

              SOAPAction
              
              SOAPMessage
              

              SOAPAction的价值是     getHealthcareCenterInfo

              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>

              授权

              Bearer 9970836add803ff1184d985bbb59669
              

              内容类型

              application/xml;charset=UTF-8
              

              1. 最后,我在Chrome浏览器中收到了以下消息

                202接受

              2. ESB日志如下。

                [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. 直接调用ESB成功,但使用AM失败。我该怎么做??? 我想使用apim(不是202接受的消息)
                2. 获得以下响应

                  我想跟进回应

                  <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 个答案:

答案 0 :(得分:0)

这是我的错。在步骤5.2中,我修改如下,它的工作原理!!!

5.2在实施步骤

端点类型是

HTTP Endpoint

生产WSDL

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