Hi I am trying to use Data Service Call. When I use it in any proxy service in wso2 I get an error Unknown mediator referenced by configuration element: dataServiceCall
https://apim.docs.wso2.com/en/latest/reference/mediators/dss-mediator/
I am following the link as mentioned above. Can someone guide me what am I doing wrong ?
Below is the code I have written
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="TestData" startOnLoad="true" transports="http https local" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<dataServiceCall serviceName="Hello">
</dataServiceCall>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
</proxy>
Probably this has to do with the version of the Integration Studio you are using. It seems the IDE is unable to find the DataServiceCall Mediator. First, try updating the Integration Studio referring this document. If that doesn't work, try using a newer version of the Integration Studio.
Once updated the Dataservicecall Mediator should be listed under the Mediators section.
You are calling a dataservice but you didn't initiate this dataservice project before,so you have to make a dataservice before calling this dataservice from the proxy service.After that a design of "dataServiceCall " will appear in the integration Studio.
Related
We are using Java 8, Apache CXF as a SOAP client on top of Spring Boot to send SOAP messages to WS.
If the app is deployed as a WAR on Tomcat 8, the app works well and the SOAP client is sending the right XML messages with the right namespaces.
If the same app WAR is deployed on Weblogic 12c the SOAP message that is produced by the CXF SOAP client has missing namespaces.
We know that the WebLogic maybe uses some old JAXB jars that are responsible for creating the XML message from Java objects and they are different then the Tomcat server and this maybe the reason why we are seeing this issue.
We also know that we can specify in the weblogic.xml in the war file what jars the Weblogic needs to load from the war and what dependencies to load from directly from the Weblogic libraries, but every combination that we tried in the weblogic.xml does not work.
Any good advice will be fully appreciated
Sample XML output from Tomcat server with Apache CXF
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<event xmlns="http://www.test.com" xmlns:ns5="http://www.test2.com" xmlns:ns3="urn:test1:1423.15465:123123:namespace">
<ns5:created-date-time>2020-08-12T08:02:35Z</ns5:created-date-time>
<ns5:payload>
<Test2>
<ns3:ID>f14bb</ns3:ID>
<ns3:createdDateTime>2020-08-12T08:02:35Z</ns3:createdDateTime>
</Test2>
</ns5:payload>
</event>
</env:Body>
</env:Envelope>
Sample code from Weblogic 12c
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<event xmlns="http://www.test.com" xmlns:ns5="http://www.test2.com">
<ns5:created-date-time>2020-08-12T08:02:35Z</ns5:created-date-time>
<ns5:payload>
<Test2>
<ID>f14bb</ID>
<createdDateTime>2020-08-12T08:02:35Z</createdDateTime>
</Test2>
</ns5:payload>
</event>
</env:Body>
</env:Envelope>
The "urn:test1:1423.15465:123123:namespace" is completely ignored in the weblogic server making this XML message not valid by the consumer
weblogic.xml
we are trying to tell weblogic to load our classes from the war file instead of the JaxB classes from the web logic but without success
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>java.xml.bind.*</wls:package-name>
<wls:package-name>org.apache.cxf.*</wls:package-name>
<wls:package-name>javax.xml.ws.*</wls:package-name>
<wls:package-name>javax.wsdl.*</wls:package-name>
</wls:prefer-application-resources>
</wls:container-descriptor>
Except this issue everything else is working fine, the Apache CXF is sending correct in multiple scenarios, just in one is it not adding the namespace we need
It looks like you are describing a class loading problem here. Thus, kindly use the below tag in your weblogic.xml descriptor.
<prefer-web-inf-classes>false</prefer-web-inf-classes>
Some years ago I was struggling with class loading issues because I was missing it. Below you have an example about this extracted from this blog.
If after applying this you still are facing issues with the class loader, you should install Classloader Analysis Tool (CAT) to get the class loader, which is loading the conflicting classes. In this blog you will have some instructions about how to use CAT.
Importantly, in this document Oracle states about this
Note that in order to use prefer-application-packages or prefer-application-resources, prefer-web-inf-classes must be set to false.
This issue was solved by updating the package-info.java
#javax.xml.bind.annotation.XmlSchema(namespace = "urn:test1",
xmlns = {#XmlNs(prefix = "",
namespaceURI = "http://www.test.com")},
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
This is the part of the package-info that was not been there before
xmlns = {#XmlNs(prefix = "",
namespaceURI = "http://www.test.com")}
adding the namespace trick JavaXB to add the original namespace
Please check the mentioned page, which has a different Filtering classloading:
<wls:prefer-application-packages>
<wls:package-name>com.ctc.wstx.*</wls:package-name>
<wls:package-name>javax.wsdl.*</wls:package-name>
<wls:package-name>org.apache.cxf.*</wls:package-name>
<!-- <wls:package-name>javax.jws.*</wls:package-name> -->
</wls:prefer-application-packages>
Why can't I "Add Service Reference" in Visual Studio to this odata endpoint:
<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx" Version="3.0">
<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="3.0">
<Schema xmlns="http://schemas.microsoft.com/ado/2009/11/edm" Namespace="nsuli_com">
<EntityType Name="EntityType0">
<Key>
<PropertyRef Name="DateS"/>
</Key>
<Property Name="DateS" Type="Edm.DateTime" Nullable="false"/>
</EntityType>
<EntityContainer Name="us">
<EntitySet Name="ImportedSeries_NFPDates" EntityType="nsuli_com.EntityType0"/>
</EntityContainer>
</Schema>
</edmx:DataServices>
It works from LINQPad 4 using the driver "WCF Data Services 5.5 (OData 3)"... but "Add Service Reference..." shows the error:
There was an error downloading 'http://nsuli.com/odata/us/_vti_bin/ListData.svc/$metadata'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://nsuli.com/odata/us/'.
The content type application/xml;charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 354 bytes of the response were: '<?xml version="1.0" encoding="utf-8"?><service xml:base="http://nsuli.com/odata/us/" xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"><workspace><atom:title type="text">Default</atom:title><collection href="ImportedSeries_NFPDates"><atom:title type="text">ImportedSeries_NFPDates</atom:title></collection></workspace></service>'.
If the service is defined in the current solution, try building the solution and adding the service reference again.
It should be a metadata format issue. the following service can be used to "Add Service Reference". If you can change the service side code, you can use it as demo.
http://services.odata.org/V3/OData/OData.svc/$metadata
On the other hand, OData can use T4 to generate client code now. You can refer following blog:
http://blogs.msdn.com/b/odatateam/archive/2014/03/11/how-to-use-odata-client-code-generator-to-generate-client-side-proxy-class.aspx
If I do
metadata = metadata.Replace(
"xmlns:edmx=\"schemas.microsoft.com/ado/2009/11/edmx\"",
"xmlns:edmx=\"schemas.microsoft.com/ado/2007/06/edmx\""
)
in my $metadata document, then "Add Service Reference" works just fine...........
I'm facing up to the load balance algorithm implementation for customizing the load balance endpoint.
On this documentation page:
http://docs.wso2.org/display/ESB470/Load-balance+Endpoint
I read:
Algorithm - Either a default "Round-robin" or custom loaded algorithm of the group. See more information about this algorithm in the article.
Where "article" is a link point to this page:
http://supunk.blogspot.it/2010/02/writing-load-balance-algorithm-for-wso2.html
But the referred article is not complete and doesn't tell anything about the algorithm development. Could anyone give me a valid example?
You can use below sample to send multiple request to share between diffent endpoint using RoundRobin algo.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestLoadBalance"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<endpoint>
<loadbalance algorithm="org.apache.synapse.endpoints.algorithms.RoundRobin">
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService/"/>
</endpoint>
<endpoint>
<address uri="http://localhost:9001/services/SimpleStockQuoteService/"/>
</endpoint>
<endpoint>
<address uri="http://localhost:9002/services/SimpleStockQuoteService/"/>
</endpoint>
</loadbalance>
</endpoint>
</target>
<description/>
</proxy>
As the documentation specifies, the algorithm should be an implementation of org.apache.synapse.endpoints.algorithms.LoadbalanceAlgorithm
You need to write a class implementing LoadbalanceAlgorithm interface. You can refer the existing implementations RoundRobin, WeightedRRLCAlgorithm and WeightedRoundRobin classes found in org.apache.synapse.endpoints.algorithms package.
Then create a jar file with your class and add it to <ESB_HOME>/repository/components/lib folder and restart the server.
Now when adding a Load Balance Endpoint, select Other... for the Algorithm and provide the full classname of your custom algorithm. For example: org.apache.synapse.endpoints.algorithms.WeightedRoundRobin
Looking at
LoadBalanceAlgortihm it's not possibile to simply give it a dynamic list of endpoint.
Concerning LoadBalanceMambershipHandler and its implementation (Axis2 and Service)...it uses object like:
org.apache.axis2.clustering.management.GroupManagementAgent
and
org.apache.axis2.clustering.ClusteringAgent
so you have to configure your nodes in cluster using the axi2.xml inside /repository/conf/axis2 folder of your ESB.
Use the ESB registry to save the loadbalance enpoint in and then access it by code for adding it a new list of address endpoint.
I am developing a webapp with an embedded webservice with Axis2 using Maven.
The service implementation is a POJO with RPC-style interaction, the target appserver is Tomcat running the Axis2 servlet.
The "Hello world" works but now I need to configure some global axis2 settings in the axis2.xml file (placed under WEB-INF/conf).
Please provide or point to a simple configuration for axis2.xml for this common environment.
The default taken from the binary distribution has too many features activated (hotdeploy?) and also causes this problem:
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">
The ServiceClass object does not implement the required method
in the following form: OMElement ping(OMElement e)
</soapenv:Text>
</soapenv:Reason>
As a reference: http://axis.apache.org/axis2/java/core/docs/servlet-transport.html says to configure the servlet transport in this way, but it does not solve the issue.
<transportReceiver name="http" class="org.apache.axis2.transport.http.AxisServletListener"/>
Apparently the problem is that the default axis2.xml sets raw xml messageReceivers, instead of the RPC ones.
Try to add this to the services.xml for the developed service, should fix the problem.
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
</messageReceivers>
"Solution that worked for me was adding the operation tag in the service.xml against the Java Service method name:
<operation name="sayHello" >
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
</operation>
<parameter name="ServiceClass" locked="false">com.learning.webservices.pojo.HelloService</parameter>
I am currently playing around with the WSO2 enterprise service bus, some cxf based webservices and mtom attachments.
Using SoapUI (MTOM enabled), I submit the following request to one backend service:
...
<incident>
....
<attachmentList>
<attachment>
<contentID>cid:soapui32.png</contentID>
</attachment>
</attachmentList>
</incident>
...
With MTOM enabled Raw data is
...
<attachmentList>
<attachment>
<contentID>
<inc:Include href="cid:soapui32.png" xmlns:inc="http://www.w3.org/2004/08/xop/include"/>
</contentID>
</attachment>
</attachmentList>
...
------=_Part_0_22113723.1360006252844
Content-Type: image/x-png; name=soapui32.png
Content-Transfer-Encoding: binary
Content-ID: <soapui32.png>
Content-Disposition: attachment; name="soapui32.png"; filename="soapui32.png"
......
So far, so good.
Now, as the next step, I create a WSDL based proxy service (WSO2 ESB 4.5.1) for this webservice.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="testService" transports="https,http" statistics="enable" trace="enable" startOnLoad="true">
<target>
<outSequence>
<send/>
</outSequence>
<endpoint>
<wsdl service="IncidentService" port="IncidentServicePort" uri="uri2myservicewsdl"/>
</endpoint>
</target>
<publishWSDL uri="uri2myservicewsdl"/>
<description></description>
</proxy>
enableMTOM is set to true in the axis2.xml, MTOM is enabled for the proxy service.
If I submit exactly the same request with the same attachment via SoapUI, the esb transforms the attachment to inline content (debug log):
DEBUG - Starting Activation Handler invocation. Incoming Message:
......
<incident>
<attachmentList>
<attachment>
<contentID>iVBORw0KGgoAAAANSUh.....</contentID>
</attachment>
</attachmentList>
</incident>
.....
</soapenv:Body></soapenv:Envelope>
{org.wso2.carbon.activation.module.ActivationHandler}
Where can I enable MTOM, so that the proxy doesnt transform it to inline content?
Many thanks in advance.
Workaround
Maybe someone is interested, even if it's just a workaround:
I had enabled MTOM and SwA attachments in the axis2.xml (wso2 esb conf directory).
As soon as I disabled SwA and only left MTOM enabled, attachments are not transformed to inline content any more.
Now SwA is disabled for all proxy services, but that's ok for the moment.
I will have another look at it later, maybe it's a bug.