How to pass values to SOAP service using web service consumer? - mule

Hello i have an soap service , in which a method will receive 2 input values and gives a bool O/P.
i am using web service consumer endpoint to consume this soap service. i want to understand what is the way i can send values to SOAP service .
`<ws:consumer-config name="Web_Service_Consumer" wsdlLocation="http://.....?singleWsdl" service="ClientService" port="WSHttpBinding_IClientService" serviceAddress="http://....../ClientService.svc" doc:name="Web Service Consumer"/>
<ws:consumer config-ref="Web_Service_Consumer" operation="AuthenticateUser" doc:name="Web Service Consumer"/>

The web service consumer is very tipically used in conjunction with DataMapper, with it datamapper can pretty much visually construct a request for you. Given that DataMapper is an EE feature and you don't mention you have a license I suggest you changing approach and rather use the CXF module.

Based of the web service consumer documentation, the consumer is expecting the xml request of the service operation.
My quick suggestion is to use any tool to build the xml request based on the wsdl (such as SOAP UI) and use it in a set-payload, using MEL expressions to inject the two parameter values.
Hope it helps.

Please go through to get a better understanding on ws:consumer :- http://www.mulesoft.org/documentation/display/current/Web+Service+Consumer+Reference and http://www.mulesoft.org/documentation/display/current/Web+Service+Consumer
also there is an example in github:- https://github.com/mulesoft/mule-tooling-examples/blob/master/web-service-consumer/src/main/app/tshirt-service-consumer.xml
You can use <stdio:inbound-endpoint system="IN" doc:name="STDIO"/> to pass values to the service .. But I am not sure if it is a recommended approach ..
Another option is set-payload you can try to pass the value to the service

You can try this with this example
<ws:consumer-config name="Web_Service_Consumer"
wsdlLocation="somelocation_1.0.wsdl"
service="GreeterResponderService" port="GreeterResponderPort"
serviceAddress="http://user:password#localhost:8088/mockbinding"
doc:name="Web Service Consumer"/>

Related

Mule Junit Testing a <ws:proxy/> pattern

I have a mule xml that doesn't have a flow but using pattern to achieve the result.
How to unit test this pattern as flow is not present?
My xml looks like:
<mule>
<ws:proxy>
</ws:proxy
</mule>
I usually test my mule flows using a "black box" approach, and I do not execute my flows directly. Instead, I generate a web request directly using perhaps the Jersey HTTP client.
In your case, you probably want to make sure that the proxied web service is not called during your test. You can mock the service using the confluex-mock-http library or something similar.

Using basicHttpbinding and get the response in raw data

I've looked all day and I couldn't able to find a correct answer on how get the response of my Web Service using basicHttpBinding without the SOAP formatting.
Can anyone know how to do that ? or another way for getting the raw data ? (like a string)
You have to use webhttpBinding. Look at the following articles, it might help you:
Creating WCF Service with SOAP/REST Endpoints
How to enable REST and SOAP both on the same WCF Service
An Introduction To RESTful Services With WCF

Microsoft WCF - SOAP messaging protocol

is that correct that the default Web Service created using WCF will have WSDL but the message transmission required should not have SOAP tags like
<soap:envelope>, <soap:header>, <soap:body> ?
Are they still using SOAP 1.1 in this case then?
And then, how can I create another web service using JAX-WS that is following this standard?
Thanks a bunch,
Robert
It's not clear to me what you're asking but if you're trying to invoke java based services (Apache, Metro, etc...) with a WCF client, take a look at the WCF Express Interop bindings.

NServiceBus and WCF

I want to achieve the following:
Expose WCF endpoint to client from which they request a long-running operation.
Map the inbound request to a NServiceBus Message.
Publish the message to the bus for processing.
Send a reply to the client acking that their request has been received and we will begin processing it.
Bus works the message through a handler.
Can you help me with some examples here please?
Thanks in advance
You can check out the WcfIntegration sample that comes with NSB to see how to expose an endpoint via WCF. To hand off the message, you can simply call Bus.Send() to another endpoint to do processing, then use the Bus.Return() that is in the sample. From there, the other endpoint can look just like the Server part of the FullDuplex sample without the Bus.Reply() logic.
Awhile ago I created some example code that is similar to this, although it used a traditional ASMX web service and not a WCF one, but that is really just an implementation detail.
Check out NServiceBus External WebService Example on GitHub.

Create WCF Json/RESTful service client proxy

here is my question: Is there any tool to generate one service client proxy when the service is Rest/Json? the service is WCF, and one of the clients is WPF and i need this in order to create the tests with similar code than I test the classic Soap WCF services.
If not What is the best way to achieve this?
Thanks in advance
No, there isn't simply because there is no metadata with RESTful protocols such as you get the WSDL from SOAP.
If the service is WCF, you can use the svcutil.exe util to create a client even if you're using JSON or REST as the binding.
This thread has information on it:
Client configuration to consume WCF JSON web service