I want to invoke a BPS process from CEP through SOAP method, but got an exception in BPS side.
the event output formatter such as:
<?xml version="1.0" encoding="UTF-8"?>
<eventFormatter name="output_formatter" statistics="disable"
trace="enable" xmlns="http://wso2.org/carbon/eventformatter">
<from streamName="output" version="1.0.0"/>
<mapping customMapping="enable" type="xml">
<inline>
<TestEchoRequest>
<input>{{meta_output}}</input>
</TestEchoRequest>
</inline>
</mapping>
<to eventAdaptorName="outputadapter" eventAdaptorType="soap">
<property name="headers">SOAPAction:"http://wso2.org/bps/sample/process" </property>
<property name="username">admin#carbon.super</property>
<property name="password">admin</property>
<property name="url">http://192.168.20.213:9767/services/TestEcho/</property>
</to>
</eventFormatter>
but from the view of Enter Event Formatter Details, the headers property was mismatch to the XML version, lost the bottom half of "SOAPAction".
if fire the event from Event Stream Simulator, the BPS got an exception:
TID[-1234] [BPS] [2015-08-27 09:51:08,064] ERROR {org.apache.axis2.engine.AxisEngine} - The endpoint reference (EPR) for the Operation not found is http://192.168.11.250:9767/services/TestEcho/ and the WSA Action = . If this EPR was previously reachable, please contact the server administrator.
the message sent by CEP is just like this, it seems that the SOAPAction header is lost:
POST / HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: ""
User-Agent: Axis2
Host: 192.168.20.213:9767
Transfer-Encoding: chunked
400
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1"><wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-71"><wsu:Created>2015-08-28T05:14:09.554Z</wsu:Created><wsu:Expires>2015-08-28T05:19:09.554Z</wsu:Expires></wsu:Timestamp><wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-72"><wsse:Username>admin</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">admin</wsse:Password></wsse:UsernameToken></wsse:Security></soapenv:Header><soapenv:Body><event xmlns="http://wso2.org/carbon/event"><metaData><im>AAAAAAA</im></metaData></event></soapenv:Body></soapenv:Envelope>
0
Is it a bug or any suggestion ?
Above is a known issue in WSO2 CEP 3.1.0, see [1].. As a workaround can you call the soap12 endpoint of TestEcho service because SOAPAction property is optional in soap12 (Add complete url with soap12 endpoint for url property)..
example,
http://192.168.20.213:9767/services/TestEcho.TestEchoHttpsSoap12Endpoint/
[1] https://wso2.org/jira/browse/CEP-1108
Related
I am implementing an application which would be exposed using RESTful web service. This application would firstly consume a RESTful web service to get the JSON file and would return this JSON file to the requestor (application which would consume my service). I am facing issues consuming the web service.
ERROR:
org.apache.camel.component.restlet.RestletOperationException: Restlet operation failed invoking https:// <--url-->
with statusCode: 1001 /n responseBody:HTTPS/1.1 - Communication Error (1001) -
The connector failed to complete the communication with the server
at org.apache.camel.component.restlet.RestletProducer.populateRestletProducerException(RestletProducer.java:233)
CODE:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<camelContext id="camelcontext" xmlns="http://camel.apache.org/schema/spring">
<restConfiguration component="restlet" port="9091"/>
<rest path="/say">
<get uri="/hello" consumes="application/json" produces="application/json">
<to uri="direct:hello" />
</get>
</rest>
<route>
<from uri="direct:hello"/>
<to uri="restlet:https:// <--URL--> ?restletMethod=POST" />
</route>
</camelContext>
</beans>
Maby incoming request has additional headers, for example as in this issue Apache camel jetty RestletOperationException on invoking request 1001 when mocked restlet endpoint ("org.restlet.http.headers"). You can check and remove unnecessary headers from the request. Also, error may occur while the response by the same reason, check our service for set headers.
I am trying to access a 3rd party web service using Apache CXF 3.1. When I call the service with the wsdl2java generated code or curl the service returns an exception indicating the message is not a valid SOAP message. See the message below.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<connectivityTest xmlns="urn:cdc:iisb:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="connectivityTest">
<echoBack>Hello IIS!</echoBack>
</connectivityTest>
</soap:Body>
</soap:Envelope>
When I remove the namespace (soap:) and call the service using curl the service works. See working message below.
<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns="http://www.w3.org/2003/05/soap-envelope">
<Body>
<connectivityTest xmlns="urn:cdc:iisb:2011" xmlns:ns2="http://www.w3.org/2003/05/soap-envelope">
<echoBack>Hello IIS V2!</echoBack>
</connectivityTest>
</Body>
How do I remove the namespace from the Envelope and Body elements of my SOAP message before it sent? Based on searching the web it looks like I may need to create an interceptor. If some one can provide an example of an interceptor to remove the namespace from the Envelope and Body elements it would be much appreciated.
Thanks in advance!
JR
No Interceptor is required for this. You can configure the namespace in your jaxws properties.
<jaxws:properties>
<entry key="soap.env.ns.map">
<map>
<entry key="" value="http://schemas.xmlsoap.org/soap/envelope/"/>
</map>
</entry>
<entry key="disable.outputstream.optimization" value="true"/>
</jaxws:properties>
I have a rest API with the Content-Type = application/json, provided by a tomcat server.
This means that all the responses are supposed to be in the json format.
The rest API is called by the WSO2 ESB to pass some data.
in case that the application providing the rest API is down (but the tomcat server is still up), the tomcat server replays with the http code=404 with the Content-Type=text/html (sending the HTML page "The requested resource is not available.") what results into the ESB error "Error while building message" exception and ESB crashes and losses the message.
Can you please suggest how to handle such a scenario? I'd need to receive the msg and react on this event. Is there perhaps a way how to dynamically switch content-types?
Can you try this with your own modification:
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="fault_filter_based_http_status_code" trace="disable">
<filter regex="401" source="get-property('axis2', 'HTTP_SC')">
<then>
<makefault version="soap11">
<code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/" value="soap11Env:Server"/>
<reason value="Unauthorized to access the resource"/>
<role/>
</makefault>
<send/>
</then>
<else/>
</filter>
<filter regex="500" source="get-property('axis2', 'HTTP_SC')">
<then>
<makefault version="soap11">
<code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/" value="soap11Env:Server"/>
<reason value="Internal Server Error Occurred"/>
<role/>
</makefault>
<send/>
</then>
<else/>
</filter>
</sequence>
Take a look: http://harshcreationz.blogspot.com/2016/02/common-and-error-handling-sequences.html
I am absolutly new in WSO2 and I am working on a WSO2 Enterprise Integrator project containing this ESB project section (I think that my question is only related to ESB).
So my doubt is: I have an XML file defining an API. The flow starts with a payloadFactory mediator, something like this:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/xxxTest2" name="xxxTest2" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence>
<!-- Create empty message to get all samples from DSS -->
<!-- Get Sample ID -->
<payloadFactory media-type="xml">
<format>
<body/>
</format>
<args>
<arg evaluator="xml" expression="get-property('uri.var.int_val')" xmlns:ns="http://org.apache.synapse/xsd" xmlns:ns3="http://org.apache.synapse/xsd"/>
</args>
</payloadFactory>
<!--
Adding an header that defines the actionr related to the "FindNotProcessed" DSS service
used to retrieve all the unprocessed resource on the DB
-->
<header name="Action" scope="default" value="urn:FindNotProcessed"/>
<!-- Log the request generated by the previous payloadFactory mediator: -->
<log level="full"/>
...............................................................
...............................................................
...............................................................
</api>
My doubt is: this payloadFactory mediator generate and empty message because its content is:
<format>
<body/>
</format>
The next element in the chain is the header mediator:
<header name="Action" scope="default" value="urn:FindNotProcessed"/>
used to set a new header having name="Action" that specify (as value) the name of a DSS service to obtain some data from the DB.
Finnally the next element in the chain is a log mediator. It seems to me that is is used to log the message generated by the concatenation of the previous payloadFactory mediator chianed with the following header mediator.
This log mediator generate this log:
TID: [-1234] [] [2017-03-28 10:05:30,943] INFO {org.apache.synapse.mediators.builtin.LogMediator} -
To: /glisTest2, WSAction: urn:FindNotProcessed, SOAPAction: urn:FindNotProcessed, MessageID: urn:uuid:95913219-2ad1-4488-a260-78693f3bbde2, Direction: request,
Envelope:
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<body xmlns="http://ws.apache.org/ns/synapse"/>
</soapenv:Body>
</soapenv:Envelope> {org.apache.synapse.mediators.builtin.LogMediator}
My doubts are:
1) Why is it generating an XML message that embedd a soapenv structure?
2) It depends by the fact that the header meadiator defines scope="default" that should coincide to Synapse. Because reading the official documentation:
https://docs.wso2.com/display/ESB481/Header+Mediator
it says:
Scope: Select Synapse if you want to manipulate SOAP headers. Select
Transport if you want to manipulate HTTP headers.
so I think that settings in this way is generating a SOAP message and so is the reason because my message is into the soapenv structure.
Is it or am I missing something?
By default, all the messages in the WSO2 EI/ESB will be treated as SOAP messages, that's why your payload is enclosed in the soap envelope.
Headers actually work when you send the message to an endpoint, so if you have an endpoint http://hostname:port/abc/xyz , the Action (Soap Action) of the message will be set as urn:FindNotProcessed. It means that the message will go to the urn:FindNotProcessed operation of the endpoint, provided the endpoint is a soap endpoint.
Thanks
I have an issue which I do not have an idea how to resolve it. I am on WSB2 ESB 4.9.0.
I am trying to call a topic through a proxy using an event. However this never call the proxy subscribed to it.
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="publishSubscribeTest" startOnLoad="true" trace="disable"
transports="http https" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log level="custom">
<property value="********************* START METHOD *********************" name="publishSubscribeTest"/>
</log>
<event topic="TestTopic"/>
<log level="custom">
<property value="********************* END METHOD *********************" name="publishSubscribeTest"/>
</log>
</inSequence>
<outSequence>
<drop/>
</outSequence>
<faultSequence/>
</target>
</proxy>
The topic has the following details:
Topic Name: TestTopic
Permissions Details: (Everyone has permission to subscribe and publish)
WS Subscription Details: Another custom proxy in WSO2 has been configured as WS Subscription Details.
So when first proxy calls the topic, it should call the proxy subscribed to that topic. However it is never called.
This is the proxy called by topic:
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="proxyCalledByTopic" startOnLoad="true" trace="disable"
transports="https http" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log level="custom">
<property value="********************* START METHOD *********************" name="proxyCalledByTopic"/>
</log>
</inSequence>
<outSequence>
<send/>
</outSequence>
<faultSequence/>
</target>
</proxy>
So the log should be something like:
publishSubscribeTest = ********************* END METHOD
********************* proxyCalledByTopic = ********************* START METHOD ********************* publishSubscribeTest =
********************* START METHOD *********************
However it is like:
publishSubscribeTest = ********************* END METHOD
********************* publishSubscribeTest = ********************* START METHOD *********************
So I understand that the proxy called by the topic in the subscription is not called.
Any suggestion? Any help?
After some try outs, the issue why the pub sub was not triggering the event was due to the fact that content-type header needs was not populated appropriately from the incoming request to the proxy service. The same can be achieved from setting up an POST api.
Once the content-type header is populated with either of the below values, the pub/sub events started working.
Content-Type: application/json
Content-Type: application/xml
Sample Posts:
XML
POST /TriggerTopic HTTP/1.1
Host: 10.224.234.34:8280
Content-Type: application/xml
Cache-Control: no-cache
Postman-Token: f60c206c-a38e-ed2d-46a0-b051304247be
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Dont forget me this weekend from postman via API</body>
</note>
Sample Post JSON
POST /TriggerTopic HTTP/1.1
Host: 10.224.234.34:8280
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 3453ddc5-a279-203a-fecf-38e81bd3ba8b
{"value":"some value"}