Data service SOAP operation has one parameter.
How do I pass this parameter to the callout mediator?
Callout source code:
<?xml version="1.0" encoding="UTF-8"?>
<callout action="urn:getVendorsOperation"
serviceURL="http://...:8280/services/myService/" xmlns="http://ws.apache.org/ns/synapse">
<source type="envelope"/>
<target key="response"/>
</callout>
the parameter:
<?xml version="1.0" encoding="UTF-8"?>
<property expression="get-property('uri.var.filterQuery')"
name="filterQuery" scope="default" type="STRING" xmlns="http://ws.apache.org/ns/synapse"/>
UPD:
WSDL FILE: http://...:8280/services/myService?wsdl
https://drive.google.com/file/d/1JLpIhHO_Jbk2bSWNodudnyG_X8fXUuCy/view?usp=sharing
When you have Data Services - it creates webservice for which you should create appropriate request. In body / payload you use that parameter to get data back from request. What should the request look like? You can see by using wsdl. http://...:8280/services/myService?wsdl and there can be handy tool like SoapUI for generate body of that request. If you are using WSO2EI i recommend use DSS in local transport, it has better performance and not exposing it through http.
The documentation is not recommend using calloutMediator and it say is better to use callMediator.
Related
I'm using wso2am with 1.10.0 version.
I have a API (Content-Type: multipart/form-data)
but when request invoked, endpoint(real api server) can't receive Content-Type header.
I found a solution.
http://prabu-lk.blogspot.kr/2015/09/how-to-preserving-http-headers-in-wso2.html
but this solution is a global setting.
The reason I can not use this solution is because of the other api.
This api changes the content-type in customhandler.
So i want use mediation to be applied in units of api.
If you know how to fix it, please help me.
Have you tried to add a custom sequence to API and set the header from there?
Refer document here for more info. This should add as an in-sequence.
Your sequence should look like this.
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="header-sequence">
<header name="Content-Type" value="multipart/form-data"/>
</sequence>
I am very new in WSO2 and I have the following doubt related to an ESB project on which I am working.
In this ESB application I am sending a message to a named endopoint mediator, something like this:
<send>
<endpoint key="echoEndpoint"/>
</send>
This is the contend of the related echoEndpoint.xml file in my project:
<?xml version="1.0" encoding="UTF-8"?>
<endpoint name="echoEndpoint" xmlns="http://ws.apache.org/ns/synapse">
<address format="soap11" statistics="enable" trace="enable" uri="http://localhost:8280/services/echo"/>
</endpoint>
So what exactly does this endpoint? The http://localhost:8280/services/echo is something like a predefined endopoined provided natively by WSO2? or what?
echo service included into esb/ei by default. You can see it in Carbon Panel -> Main -> Manage -> Services. There you can test it via "Try It" feature. It has few methods:
echoInt extected to get integer as argument and returned same integer value
echoString - expected to get string value as argument and returned same value
echoOMElement - received XML as argument and returned same XML
and some other methods. General idea - this service returned same value as it is received.
This service is helpful for testing purposes.
This is a service that by default is already displayed when you run the ESB. Echo.aar is located in the path repository\deployment\server\axis2services . And wsdl you can see https://localhost:your_Port/services/echo?wsdl
How to develope a web service in WSO2 using proxy services ?
Applying my Oracle Service Bus knowledge here to create a proxy service which would take a string as an Input and return the same as response, I find it difficult in WSO2 to create a proxy service using my XML Schema.
I found that we can do the same in WSO2 using Custom proxy template.
But I am not sure of defining an Input and output in proxy service ;
In a traditional Oracle Service Bus we can do it by defining our XMl Schemas.
Seems like you need some echo kind of a service. This kind of behavior can be achieved by configuring the wso2 esb as in following manner. However this is not really a web service. I hope you are aware of what is web service and what does a proxy service does. But for your requirement you can try something like follows.
<proxy name="loopBackProxy" startonload="true" statistics="disable" trace="disable" transports="https,http" xmlns="http://ws.apache.org/ns/synapse">
<target>
<insequence>
<log level="full"></log>
<header action="remove" name="To"></header>
<property name="RESPONSE" value="true"></property>
<!-- your esb modifications here -->
<send></send>
</insequence>
</target>
<description></description>
</proxy>
This doesnot contains a outsequence, what this does is redirects the input to the client.
I create a simple WSDL proxy in WSO2 to allow Soap 1.2 enabled applications to work with Soap 1.1 only external web service. Everything is fine except WSO2 doesn't transform soap11 replies back to soap12 when I send request via Soap12 WSO endpoint.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="MySOAP" transports="http"
statistics="disable" trace="disable" startOnLoad="true">
<target>
<endpoint>
<wsdl service="ExtService" port="ExtPort" uri="https://my.local/wsdl/current
/ExtService.wsdl"/>
<property name="DISABLE_CHUNKING" value="true" scope="axis2"/>
</endpoint>
</target>
<publishWSDL uri="file:///home/sysadmin/MySOAP.wsdl"/>
<description></description>
</proxy>
Has anybody faced anything similar? WSO2 ESB version 4.6.0
You need to add the format as following.
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap11" />
</endpoint>
Format - The message format for the endpoint. The available values are:
[format="soap11|soap12|pox|get"]
Leave As-Is - No transformation is done to the outgoing message.
SOAP 1.1 - Transforming message to SOAP 1.1.
SOAP 1.2 - Transforming message to SOAP 1.2.
Plain Old XML (POX) - Transforming to plain old XML format
Representational State Transfer (REST) - Transforming to HTTP Get
Request
GET
http://docs.wso2.org/wiki/display/ESB460/Default+Endpoint
This has been an issue for a while now. See jira https://wso2.org/jira/browse/ESBJAVA-1994.
If you don't want to manually transform your response from the backend, uncomment the relevant NHTTP transport entries in axis2.xml and comment out the HTTP PassThrough transport entries.
We have a legacy application that is only able to upload files through ftp protocol. Our current application has SOAP interface for similar file submissions. Is there any way to configure the WSO2 ESB to transform the uploaded file through ftp to SOAP request for consuming by our current application?
Yes that is a very common approach. You can create a VFS proxy that is reading from an FTP. You may then make a transformation (depends on the input format) (i.e. XSLT) to fit your SOAP Endpoint and then simply make a <send> to your WS.
Here an example (only pseudo-code - not tested), but will give you a good starting point:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="ftp_proxy_example" transports="vfs" startOnLoad="true" trace="disable">
<parameter name="transport.PollInterval">10</parameter>
<parameter name="transport.vfs.FileURI">vfs:ftp://user:password#server/path</parameter>
<parameter name="transport.vfs.FileNamePattern">.*[.]xml</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<target faultSequence="errorSequence">
<inSequence>
<!-- maybe a transformation -->
<!-- send to your WS endpoint -->
</inSequence>
</target>
</proxy>