Exposing web service in mule - web-services

I want to expose a web service. I have WSDL file with me. I am using CXF proxy service as operation. Now, I have doubt that in Inbound attributes value of port,namespace & service should take from WSDL file only,Right?
If yes, then, after deploying through, http://localhost:8081?wsdl this link am not getting same WSDL which I want to expose.
So, tell me where am I going wrong?Thanks.
To test the project, which URL should use in SoapUI, so that appropriate request XML will generate...
Here is my flow,
<flow name="meterreadingdocumenterpresultbulkcreateconfirmation_outFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<cxf:proxy-service configuration-ref="CXF_Configuration" port="MeterReadingDocumentERPResultBulkCreateConfirmation_OutPort" namespace="http://sap.com/xi/IS-U/Global2" service="MeterReadingDocumentERPResultBulkCreateConfirmation_OutService" payload="body" doc:name="CXF" validationEnabled="true"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<mulexml:dom-to-xml-transformer doc:name="DOM to XML"/>
<logger level="INFO" doc:name="Logger" message="#[payload]"/>
</flow>
After exposing a web service I am not getting proper response...

Related

Mule WSDL Connector

I use version 3.8 (3.8.3) .
I basically want to host my wsdl in a different location other than http://{serviceurl}?wsdl like http://{serviceurl}/my-great-service.wsdl
At the following mule doc
https://docs.mulesoft.com/mule-user-guide/v/3.8/wsdl-connectors
it says that you can specify the _wsdlLocation_ property of the CXF endpoint as follows
<endpoint address="wsdl-cxf:http://localhost:8080/book/services/BookService?method=getBooks">
<properties>
<property name="wsdlLocation" value="file:///c:/BookService.wsdl"/>
</properties>
</endpoint>
But where to put this in the mule xml ?
To the root of the file <mule> here </mule> or to <flow> here </flow> or to the <cxf:proxy-service> here </cxf:proxy-service>
The mule documentation is so limited and lock of examples.
Any reason why you are using the cxf connector instead of the web service consumer?
https://docs.mulesoft.com/mule-user-guide/v/3.8/web-service-consumer
All the global configuration elements are specified after the <mule> tag and before the <flow> elements.
Example with web service consumer below:
<mule ......>
<ws:consumer-config name="Web_Service_Consumer" service="ServiceService"
port="ServicePort" serviceAddress="addresUrl"
wsdlLocation="wsdl location" doc:name="Web Service Consumer"/>
<flow>...</flow>
</mule>
If for any reason you want to use the cxf connector, is the same but using the cxf connector

The soap services is working in SOAPUI but its not working in mule soft web services consumer

I have web service wsdl file and its loaded successfully in SOAPUI. This is an request method.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org /soap/envelope/" xmlns:asi="http://siebel.com/asi/">
</soapenv:Header>
<soapenv:Body>
<asi:VSPOSCSyncRealTimeQueryById>
<PrimaryRowId>1-test</PrimaryRowId>
</asi:VSPOSCSyncRealTimeQueryById>
</soapenv:Body>
</soapenv:Envelope>
This above method is an working fine in SOAPUI. But when I try
to implement in mulesoft using web service consumer then the method is not populating.
This is an screen shot .
The above picture showing that the mule soft web service consumer is populating the only parameter without operation name but SOAPUI is populating both operation and parameter and its working. so any idea why mule soft web services consumer its not populating method name with parameter.
Thanks
Ishwar
I have created a sample as below and it is wokring as expected. I am not sure if you have selected the Operation in Web Service Component. Refer the following, hope this will work for you -
Webservice Consumer Component Operation
DataMapper
<flow name="muletestFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/test" allowedMethods="GET" doc:name="HTTP"/>
<set-variable variableName="first" value="#[message.inboundProperties.'http.query.params'.first]" doc:name="first"/>
<set-variable variableName="second" value="#[message.inboundProperties.'http.query.params'.second]" doc:name="second"/>
<dw:transform-message doc:name="Transform Message">
<dw:set-payload><![CDATA[%dw 1.0%output application/xml%namespace ns0 http://tempuri.org/---
{
ns0#Add: {
ns0#intA: flowVars.first as :number
, ns0#intB: flowVars.second as :number
}
}]]></dw:set-payload>
</dw:transform-message>
<ws:consumer config-ref="Web_Service_Consumer" operation="Add" doc:name="Web Service Consumer"/>
</flow>

Mule soap Proxy wsdl fails at relative path resolution of xsd

I have a WSDL and a Mule SOAP proxy web service using the MuleSoft XML Only SOAP Web Service example.
My application is working fine but if i enable validation i have one issue: When the XSD is stored anywhere other than the root of the project, it will not resolve.
I created folders of service and xsd inside /src/main/resources,
however when the service is invoked I receive the following error:
connector.http.mule.default.receiver.02] org.apache.cxf.wstx_msv_validation.ResolvingGrammarReaderController: D:\Developer\Global\BODs\GetListSalesOrder.xsd (The system cannot find the path specified)
java.io.FileNotFoundException: D:\Developer\Global\BODs\GetListSalesOrder.xsd (The system cannot find the path)
This is my mule flow..
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="test" doc:name="HTTP"/>
<cxf:proxy-service port="SyncSalesOrderBinding" namespace="http://www.cg.com/services/oagis/salesOrder" service="SyncSalesOrderService" validationEnabled="true" payload="body" wsdlLocation="services/WebServices/WSDL/SalesOrder.wsdl" doc:name="CXF">
<cxf:schemaLocations>
<cxf:schemaLocation>services/Developer/Global/BODs/GetListSalesOrder.xsd</cxf:schemaLocation>
</cxf:schemaLocations>
</cxf:proxy-service>
<logger message="Success" level="INFO" doc:name="Logger"/>
If your XSD file is imported in your wsdl file the following Code is fine :-
<cxf:proxy-service port="SyncSalesOrderBinding" namespace="http://www.cg.com/services/oagis/salesOrder" service="SyncSalesOrderService" validationEnabled="true" payload="body" wsdlLocation="services/WebServices/WSDL/SalesOrder.wsdl" doc:name="CXF"/>
You don't need to mention your XSD file in CXF component .. it will validate
If you still face any issues then there is patch available here : https://www.mulesoft.org/jira/browse/MULE-5963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
.... Please you replace your jar with the one attached to the JIRA ... It will work definately

how can use wire-tape in mule for statstict wsdl?

i define a web-service in mule i want to get statistics user that use from web-service
how can use wire-tape in my project? what is wire-tape? i have not wire- tap in mule pallet
<flow name="service-cxf-wsdlfirstFlow1" doc:name="service-cxf-wsdlfirstFlow1">
<wire-tap>
<vm:outbound-endpoint path="tapped.channel"/>
<wildcard-filter pattern="the quick brown*"/>
</wire-tap>
<http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:8882/OrderSvcs" doc:name="HTTP"/>
<cxf:proxy-service payload="envelope" doc:name="SOAP" enableMuleSoapHeaders="false" namespace="http://tempuri.org/" service="XXX_News" wsdlLocation="http://www.XXXXXtab.org/XXXX.asmx?WSDL"/>
</flow>
The wire-tap routing message processor seems like a good candidate for what you want to achieve. From its documentation:
The WireTap message processor allows you to route certain messages to
a different message processor as well as to the next one in the chain.

Exposing WebService on Mule

I wanted expose an WebService on mule and its working.
My concern is that am not sure if this is the right approach to follow in exposing a webservice.
As I wanted to be able to view my Mule HTTP Inbound endpoint wsdl i.e
XXX:8084/HelloService?wsdl
, notice the actual service is running on port 8085.
<flow name="WS_In" doc:name="WS_In">
<http:inbound-endpoint address="http://localhost:8084/HelloService" exchange-pattern="request-response" doc:name="HTTP">
<cxf:proxy-service wsdlLocation="http://localhost:8085/HelloService?WSDL" payload="envelope" namespace="http://example.org/HelloService" service="Hello"/>
</http:inbound-endpoint>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8085" doc:name="HTTP" path="test"/>
</flow>
So you're not exposing a service but just proxying it right?
Why not using the ready made pattern for that? See: http://www.mulesoft.org/documentation/display/current/Web+Service+Proxy+Pattern
Proxying web services is a very common practice used for different reasons like security or auditing. This pattern allows a short and easy configuration of such a proxy.
With this you can
Transform the SOAP envelope (body or header) to add or remove specific entries.
Rewrite remote WSDLs so they appear to bind to services inside a corporate firewall.
Mule has already defined these proxy transformers in various ways:
Ref: https://docs.mulesoft.com/mule-user-guide/v/3.7/web-service-proxy-pattern#wsdl-redirection