1
votes

I'm attempting to use the ESB demo scripts outlined in "How to GET a Cup of Coffee the WSO2 Way" (http://wso2.com/library/articles/2012/09/get-cup-coffee-wso2-way/). I have successfully deployed and verified that the App server demo component SOAP service works correctly (StarbucksOutletService.aar) both with SOAPSonar and the App Server TryIt feature, but I am unable to get the ESB portion of the demo working correctly with WSO2 ESB 4.8.0 even though the endpoint test works correctly. See output below.

ESB window output

JAVA_HOME environment variable is set to C:\Program Files\Java\jdk1.6.0_24
CARBON_HOME environment variable is set to E:\Tools2\WSO2\WSO2ES~1.0\bin\..
[2013-12-04 10:58:49,378]  INFO - CarbonCoreActivator Starting WSO2 Carbon...
[2013-12-04 10:58:49,381]  INFO - CarbonCoreActivator Operating System : Windows 7 6.1, x86
[2013-12-04 10:58:49,381]  INFO - CarbonCoreActivator Java Home        : C:\Program Files\Java\jdk1.6.0_24\jre
[2013-12-04 10:58:49,381]  INFO - CarbonCoreActivator Java Version     : 1.6.0_24
[2013-12-04 10:58:49,381]  INFO - CarbonCoreActivator Java VM          : Java HotSpot(TM) Client VM 19.1-b02,Sun Microsystems Inc.
[2013-12-04 10:58:49,382]  INFO - CarbonCoreActivator Carbon Home      : E:\Tools2\WSO2\WSO2ES~1.0\bin\..
[2013-12-04 10:58:49,382]  INFO - CarbonCoreActivator Java Temp Dir    : E:\Tools2\WSO2\WSO2ES~1.0\bin\..\tmp
[2013-12-04 10:58:49,382]  INFO - CarbonCoreActivator User             : rsarvas, en-US, America/New_York
[2013-12-04 10:58:49,799]  WARN - ValidationResultPrinter RAM size (MB): 2047 of the system is below the recommended minimum size :2048
[2013-12-04 10:58:49,801]  WARN - ValidationResultPrinter The default keystore (wso2carbon.jks) is currently being used. To maximize security when deploying to a production environment, configure a new keystore with a unique password in the production server profi
le.
[2013-12-04 10:58:49,807]  INFO - AgentHolder Agent created !
[2013-12-04 10:58:49,835]  INFO - AgentDS Successfully deployed Agent Client
[2013-12-04 10:58:53,775]  INFO - EmbeddedRegistryService Configured Registry in 43ms
[2013-12-04 10:58:53,846]  INFO - RegistryCoreServiceComponent Registry Mode    : READ-WRITE
[2013-12-04 10:58:54,396]  INFO - UserStoreMgtDSComponent Carbon UserStoreMgtDSComponent activated successfully.
[2013-12-04 10:59:01,387]  INFO - TaglibUriRule TLD skipped. URI: http://tiles.apache.org/tags-tiles is already defined
[2013-12-04 10:59:02,585]  INFO - ClusterBuilder Clustering has been disabled
[2013-12-04 10:59:02,905]  INFO - LandingPageWebappDeployer Deployed product landing page webapp: StandardEngine[Catalina].StandardHost[localhost].StandardContext[/home]
[2013-12-04 10:59:02,905]  INFO - UserStoreConfigurationDeployer User Store Configuration Deployer initiated.
[2013-12-04 10:59:02,938]  INFO - PassThroughHttpSSLSender Initializing Pass-through HTTP/S Sender...
[2013-12-04 10:59:02,962]  INFO - ClientConnFactoryBuilder HTTPS Loading Identity Keystore from : repository/resources/security/wso2carbon.jks
[2013-12-04 10:59:02,992]  INFO - ClientConnFactoryBuilder HTTPS Loading Trust Keystore from : repository/resources/security/client-truststore.jks
[2013-12-04 10:59:03,236]  INFO - PassThroughHttpSSLSender Pass-through HTTPS Sender started...
[2013-12-04 10:59:03,237]  INFO - PassThroughHttpSender Initializing Pass-through HTTP/S Sender...
[2013-12-04 10:59:03,238]  INFO - PassThroughHttpSender Pass-through HTTP Sender started...
[2013-12-04 10:59:03,301]  INFO - DeploymentInterceptor Deploying Axis2 service: echo {super-tenant}
[2013-12-04 10:59:03,361]  INFO - DeploymentEngine Deploying Web service: Echo.aar - file:/E:/Tools2/WSO2/WSO2ES~1.0/bin/../repository/deployment/server/axis2services/Echo.aar
[2013-12-04 10:59:03,394]  INFO - DeploymentInterceptor Deploying Axis2 service: echo {super-tenant}
[2013-12-04 10:59:03,503]  INFO - DeploymentInterceptor Deploying Axis2 service: Version {super-tenant}
[2013-12-04 10:59:03,518]  INFO - DeploymentEngine Deploying Web service: Version.aar - file:/E:/Tools2/WSO2/WSO2ES~1.0/bin/../repository/deployment/server/axis2services/Version.aar
[2013-12-04 10:59:03,536]  INFO - DeploymentInterceptor Deploying Axis2 service: Version {super-tenant}
[2013-12-04 10:59:03,580]  INFO - PassThroughHttpSSLListener Initializing Pass-through HTTP/S Listener...
[2013-12-04 10:59:03,598]  INFO - PassThroughHttpListener Initializing Pass-through HTTP/S Listener...
[2013-12-04 10:59:03,676]  INFO - ModuleDeployer Deploying module: addressing-1.6.1-wso2v10 - file:/E:/Tools2/WSO2/WSO2ES~1.0/bin/../repository/deployment/client/modules/addressing-1.6.1-wso2v10.mar
[2013-12-04 10:59:03,696]  INFO - ModuleDeployer Deploying module: rampart-1.6.1-wso2v8 - file:/E:/Tools2/WSO2/WSO2ES~1.0/bin/../repository/deployment/client/modules/rampart-1.6.1-wso2v8.mar
[2013-12-04 10:59:03,709]  INFO - TCPTransportSender TCP Sender started
[2013-12-04 10:59:04,728]  INFO - DeploymentEngine Deploying Web service: org.wso2.carbon.message.processor -
[2013-12-04 10:59:04,735]  INFO - DeploymentEngine Deploying Web service: org.wso2.carbon.message.store -
[2013-12-04 10:59:05,703]  INFO - DeploymentInterceptor Deploying Axis2 service: wso2carbon-sts {super-tenant}
[2013-12-04 10:59:05,732]  INFO - DeploymentEngine Deploying Web service: org.wso2.carbon.sts -
[2013-12-04 10:59:06,026]  INFO - DeploymentEngine Deploying Web service: org.wso2.carbon.tryit -
[2013-12-04 10:59:06,301]  INFO - CarbonServerManager Repository       : E:\Tools2\WSO2\WSO2ES~1.0\bin\../repository/deployment/server/
[2013-12-04 10:59:06,375]  INFO - PermissionUpdater Permission cache updated for tenant -1234
[2013-12-04 10:59:06,413]  INFO - ServiceBusInitializer Starting ESB...
[2013-12-04 10:59:06,422]  INFO - ServiceBusInitializer Initializing Apache Synapse...
[2013-12-04 10:59:06,426]  INFO - SynapseControllerFactory Using Synapse home : E:\Tools2\WSO2\WSO2ES~1.0\.
[2013-12-04 10:59:06,426]  INFO - SynapseControllerFactory Using synapse.xml location : E:\Tools2\WSO2\WSO2ES~1.0\.\.\repository\deployment\server\synapse-configs\default
[2013-12-04 10:59:06,426]  INFO - SynapseControllerFactory Using server name : localhost
[2013-12-04 10:59:06,430]  INFO - SynapseControllerFactory The timeout handler will run every : 15s
[2013-12-04 10:59:06,438]  INFO - Axis2SynapseController Initializing Synapse at : Wed Dec 04 10:59:06 EST 2013
[2013-12-04 10:59:06,440]  INFO - CarbonSynapseController Loading the mediation configuration from the file system
[2013-12-04 10:59:06,442]  INFO - MultiXMLConfigurationBuilder Building synapse configuration from the synapse artifact repository at : .\.\repository/deployment/server/synapse-configs\default
[2013-12-04 10:59:06,442]  INFO - XMLConfigurationBuilder Generating the Synapse configuration model by parsing the XML configuration
[2013-12-04 10:59:06,562]  INFO - SynapseConfigurationBuilder Loaded Synapse configuration from the artifact repository at : .\.\repository/deployment/server/synapse-configs\default
[2013-12-04 10:59:06,565]  INFO - Axis2SynapseController Loading mediator extensions...
[2013-12-04 10:59:06,567]  INFO - Axis2SynapseController Deploying the Synapse service...
[2013-12-04 10:59:06,569]  INFO - Axis2SynapseController Deploying Proxy services...
[2013-12-04 10:59:06,569]  INFO - Axis2SynapseController Deploying EventSources...
[2013-12-04 10:59:06,576]  INFO - API Initializing API: StarbucksOrderListAPI
[2013-12-04 10:59:06,576]  INFO - API Initializing API: StarbucksPaymentAPI
[2013-12-04 10:59:06,576]  INFO - API Initializing API: StarbucksOrderAPI
[2013-12-04 10:59:06,577]  INFO - API Initializing API: StarbucksBaristaAPI
[2013-12-04 10:59:06,577]  INFO - ServerManager Server ready for processing...
[2013-12-04 10:59:06,618]  INFO - MediationStatisticsComponent Statistic Reporter is Disabled
[2013-12-04 10:59:06,618]  INFO - MediationStatisticsComponent Can't register an observer for mediationStatisticsStore. If you have disabled StatisticsReporter, please enable it in the Carbon.xml
[2013-12-04 10:59:06,724]  INFO - RuleEngineConfigDS Successfully registered the Rule Config service
[2013-12-04 10:59:07,425]  INFO - PassThroughHttpSSLListener Starting Pass-through HTTPS Listener...
[2013-12-04 10:59:07,431]  INFO - PassThroughHttpSSLListener Pass-through HTTPS Listener started on 0.0.0.0:8244
[2013-12-04 10:59:07,431]  INFO - PassThroughHttpListener Starting Pass-through HTTP Listener...
[2013-12-04 10:59:07,438]  INFO - PassThroughHttpListener Pass-through HTTP Listener started on 0.0.0.0:8281
[2013-12-04 10:59:07,442]  INFO - NioSelectorPool Using a shared selector for servlet write/read
[2013-12-04 10:59:07,965]  INFO - NioSelectorPool Using a shared selector for servlet write/read
[2013-12-04 10:59:07,985]  INFO - RegistryEventingServiceComponent Successfully Initialized Eventing on Registry
[2013-12-04 10:59:08,076]  INFO - JMXServerManager JMX Service URL  : service:jmx:rmi://localhost:11112/jndi/rmi://localhost:10000/jmxrmi
[2013-12-04 10:59:08,077]  INFO - StartupFinalizerServiceComponent Server           :  WSO2 Enterprise Service Bus-4.8.0
[2013-12-04 10:59:08,078]  INFO - StartupFinalizerServiceComponent WSO2 Carbon started in 29 sec
[2013-12-04 10:59:08,679]  INFO - CarbonUIServiceComponent Mgt Console URL  : https://137.99.96.78:9444/carbon/
[2013-12-04 10:59:21,334]  INFO - TimeoutHandler This engine will expire all callbacks after : 120 seconds, irrespective of the timeout action, after the specified or optional timeout
[2013-12-04 10:59:21,362] ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found faultstring
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:252)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
        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.rest.Resource.process(Resource.java:297)
        at org.apache.synapse.rest.API.process(API.java:298)
        at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
        at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:50)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:486)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
[2013-12-04 10:59:21,415] 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.rest.Resource.process(Resource.java:297)
        at org.apache.synapse.rest.API.process(API.java:298)
        at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
        at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:50)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:486)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found faultstring
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:252)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
        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)
        ... 17 more

CURL window output

E:\Tools2\WSO2\test>curl -v -d @order.xml -H "Content-type: application/xml" http://localhost:8281/order
* About to connect() to localhost port 8281 (#0)
*   Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8281 (#0)
> POST /order HTTP/1.1
> User-Agent: curl/7.19.3 (i386-pc-win32) libcurl/7.19.3 OpenSSL/0.9.8j
> Host: localhost:8281
> Accept: */*
> Content-type: application/xml
> Content-Length: 118
>
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/xml
< Content-Type: text/xml;charset=UTF-8
< Date: Wed, 04 Dec 2013 15:59:21 GMT
< Server: WSO2-PassThrough-HTTP
< Transfer-Encoding: chunked
<
<sb:serverError xmlns:sb="http://starbucks.example.org"><sb:errorCode>0</sb:errorCode><sb:errorMessage>Error while building message</sb:errorMessage><sb:errorDetail>org.apache.synapse.SynapseException: Error while building message
        at org.apache.synapse.mediators.AbstractMediator.handleException(AbstractMediator.java:313)
        at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:70)
        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.rest.Resource.process(Resource.java:297)
        at org.apache.synapse.rest.API.process(API.java:298)
        at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76)
        at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:50)
        at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:220)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:486)
        at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
        at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)
Caused by: 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)
        ... 15 more
Caused by: org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found faultstring
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:252)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
        at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204)
        at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.&lt;init&gt;(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)
        ... 17 more
</sb:errorDetail></sb:serverError>* Connection #0 to host localhost left intact
* Closing connection #0

E:\Tools2\WSO2\test>
E:\Tools2\WSO2\test>type order.xml
<?xml version="1.0" encoding="UTF-8"?>
<order xmlns="http://starbucks.example.org">
  <drink>Caffe Misto</drink>
</order>
E:\Tools2\WSO2\test>
E:\Tools2\WSO2\test>

The demo state that the recommended version of ESB when the demo was created in 2012 is WSO2 ESB 4.0.3. Is this genuine error or a version incompatibility with the current version of ESB?

Further edit: Below is a packet sniffer trace between ESB and the app server. Given this information it appears the the error message noted above may the result of attempting to apply formatting to a 500 error message.

POST /services/StarbucksOutletService/ HTTP/1.1
Content-Type: text/xml
Accept: */*
Transfer-Encoding: chunked
Host: 137.99.96.78:9763
Connection: Keep-Alive
User-Agent: Synapse-PT-HttpComponents-NIO

11a
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><m0:addOrder xmlns:m0="http://ws.starbucks.com"><m0:drinkName></m0:drinkName><m0:additions></m0:additions></m0:addOrder></soapenv:Body></soapenv:Envelope>
0



HTTP/1.1 500 Internal Server Error
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 04 Dec 2013 21:28:26 GMT
Connection: close
Server: WSO2 Carbon Server

fa
<faultstring>The endpoint reference (EPR) for the Operation not found is http://137.99.96.78:9763/services/StarbucksOutletService/ and the WSA Action = null. If this EPR was previously reachable, please contact the server administrator.</faultstring>
0
2

2 Answers

2
votes

I figured it out. For whatever reason the soap client code (AAR service) running in the WSO2 App server wants to see a "SOAPAction" property in the POST header. Once this was property was added to the StarbucksOrderAPI API script in WSO2 ESB the order feature started working as expected. Example:

<property name="SOAPAction" value="urn:addOrder" scope="transport"/>

Updated version of the API script included below. I may have FUBAR'ed a few things during testing, you may want to use this API script as example were you shoul place the "SOAPAction" property tags rather than using this to replace the StarbucksOrderAPI API script from the WSO2 ESB demo.

<api xmlns="http://ws.apache.org/ns/synapse" name="StarbucksOrderAPI" context="/order">
   <resource methods="POST OPTIONS PUT GET" uri-template="/{orderId}" faultSequence="StarbuckFault">
      <inSequence>
         <property xmlns:m1="http://ws.starbucks.com/xsd" xmlns:sb="http://starbucks.example.org" xmlns:m0="http://ws.starbucks.com" name="STARBUCKS_HOST_NAME" expression="$axis2:SERVICE_PREFIX"></property>
         <switch xmlns:m1="http://ws.starbucks.com/xsd" xmlns:sb="http://starbucks.example.org" xmlns:m0="http://ws.starbucks.com" source="$ctx:REST_METHOD">
            <case regex="PUT">
               <payloadFactory media-type="xml">
                  <format>
                     <m0:updateOrder>
                        <m0:orderId>$1</m0:orderId>
                        <m0:drinkName>$2</m0:drinkName>
                        <m0:additions>$3</m0:additions>
                     </m0:updateOrder>
                  </format>
                  <args>
                     <arg evaluator="xml" expression="$ctx:uri.var.orderId"></arg>
                     <arg evaluator="xml" expression="//sb:drink"></arg>
                     <arg evaluator="xml" expression="//sb:additions"></arg>
                  </args>
               </payloadFactory>
            </case>
            <default>
               <payloadFactory media-type="xml">
                  <format>
                     <m0:getOrder>
                        <m0:orderId>$1</m0:orderId>
                     </m0:getOrder>
                  </format>
                  <args>
                     <arg evaluator="xml" expression="$ctx:uri.var.orderId"></arg>
                  </args>
               </payloadFactory>
            </default>
         </switch>
         <property name="HTTP_METHOD" value="POST" scope="axis2"></property>
         <property name="SOAPAction" value="urn:getOrder" scope="transport"></property>
         <send>
            <endpoint key="DataServiceEndpoint"></endpoint>
         </send>
      </inSequence>
      <outSequence>
         <switch xmlns:m1="http://ws.starbucks.com/xsd" xmlns:sb="http://starbucks.example.org" xmlns:m0="http://ws.starbucks.com" source="$ctx:REST_METHOD">
            <case regex="OPTIONS">
               <property name="NO_ENTITY_BODY" value="true" scope="axis2" type="BOOLEAN"></property>
               <filter source="//m1:locked" regex="false">
                  <then>
                     <property name="Allow" value="GET,PUT" scope="transport"></property>
                  </then>
                  <else>
                     <property name="Allow" value="GET" scope="transport"></property>
                  </else>
               </filter>
            </case>
            <case regex="GET">
               <filter xpath="//m1:orderId">
                  <then>
                     <sequence key="StarbucksOrderInfo"></sequence>
                     <property name="Location" scope="transport" action="remove"></property>
                  </then>
                  <else>
                     <sequence key="StarbucksMissingOrder"></sequence>
                  </else>
               </filter>
            </case>
            <case regex="PUT">
               <filter xpath="//m1:orderId">
                  <then>
                     <property name="STARBUCKS_RESOURCE_LOCKED" expression="//m1:locked"></property>
                     <sequence key="StarbucksOrderInfo"></sequence>
                     <filter source="$ctx:STARBUCKS_RESOURCE_LOCKED" regex="true">
                        <property name="HTTP_SC" value="409" scope="axis2"></property>
                        <property name="Location" scope="transport" action="remove"></property>
                     </filter>
                  </then>
                  <else>
                     <sequence key="StarbucksMissingOrder"></sequence>
                  </else>
               </filter>
            </case>
         </switch>
         <send></send>
      </outSequence>
   </resource>
   <resource methods="POST" url-mapping="/" faultSequence="StarbucksFault">
      <inSequence>
         <property xmlns:m1="http://ws.starbucks.com/xsd" xmlns:sb="http://starbucks.example.org" xmlns:m0="http://ws.starbucks.com" name="STARBUCKS_HOST_NAME" expression="$axis2:SERVICE_PREFIX"></property>
         <payloadFactory media-type="xml">
            <format>
               <m0:addOrder xmlns:m0="http://ws.starbucks.com">
                  <m0:drinkName>$1</m0:drinkName>
                  <m0:additions>$2</m0:additions>
               </m0:addOrder>
            </format>
            <args>
               <arg xmlns:m1="http://ws.starbucks.com/xsd" xmlns:sb="http://starbucks.example.org" xmlns:m0="http://ws.starbucks.com" evaluator="xml" expression="//sb:drink"></arg>
               <arg xmlns:m1="http://ws.starbucks.com/xsd" xmlns:sb="http://starbucks.example.org" xmlns:m0="http://ws.starbucks.com" evaluator="xml" expression="//sb:additions"></arg>
            </args>
         </payloadFactory>
         <property name="SOAPAction" value="urn:addOrder" scope="transport"></property>
         <send>
            <endpoint key="DataServiceEndpoint"></endpoint>
         </send>
      </inSequence>
      <outSequence>
         <property name="HTTP_SC" value="201" scope="axis2"></property>
         <property xmlns:m1="http://ws.starbucks.com/xsd" xmlns:sb="http://starbucks.example.org" xmlns:m0="http://ws.starbucks.com" name="uri.var.orderId" expression="//m1:orderId"></property>
         <sequence key="StarbucksOrderInfo"></sequence>
         <send></send>
      </outSequence>
   </resource>
</api>

Unless there's a more elegant way to resolve this issue (I'm only just getting started with ESB) you will likely have to update each of the API scripts to add the correct "SOAPAction" property before the call to the service endpoint.

If anyone has a better solution please post and I'll upvote it.

0
votes

SOAP messages are dispatched in a order like configured in the axis2.xml;

 <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
            <handler name="RequestURIBasedDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
            <handler name="SOAPActionBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
            <handler name="RequestURIOperationDispatcher"
                     class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
            <handler name="SOAPMessageBodyBasedDispatcher"
                     class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>

            <handler name="HTTPLocationBasedDispatcher"
                     class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
        </phase>

Using the requestURi,using soap message etc.. If axis2 couldn't find a way on where to dispatch , it will throw bove error.

In your case, axis2 couldnt find the operation details from the incoming request..That is why you need to set the SOPAAction property