In the Spring guides a webservice is published at locationUri "/ws".
The getCountryRequest webservice is consumed using the WebServiceTemplate's marshallSendAndReceive method at "http://localhost:8080/ws/countries".
When using soapUI I consume the webservice at "http://localhost:8080/ws/" and specify the name of the webservice in the SOAP body.
So how does the WebServiceTemplate exactly use the "countries" suffix and how does it exactly map to the message with name getCountryRequest?
To answer my own question:
The wsdl is publishing the webservice at
<soap:address location="http://localhost:8080/ws"/>
But the MessageDispatcherServlet is listening at "http://localhost:8080/ws/*".
So anything beneath that URL is just passed onto SOAP and works.
I can use http://localhost:8080/ws/ (I still wonder why the WebServiceTemplate doesn't just use the WSDL SOAP address), http://localhost:8080/ws/countries or http://localhost:8080/ws/anythingGoes.
It just doesn't matter.
Related
I have a Lua proxy that needs to route requests. Each request destination is established based on the response from another HTTP request with a header from the initial request. My understanding is that HAProxy is an event-driven software, so blocking system calls are absolutely forbidden and my code is blocking because is doing an HTTP request.
I read about yielding after the request but I think it won't help since the HTTP request is already started. The library for doing the request is https://github.com/JakobGreen/lua-requests#simple-requests
local requests = require('requests')
core.register_fetches('http_backend', function(txn)
local dest = txn.sf:req_fhdr('X-dest')
local url = "http://127.0.0.1:8080/service";
local response = requests.get(url.."/"+dest);
local json = response.json()
return json.field
end )
How do I convert my code to be non-blocking?
You should consider using HAProxy's SPOE which was created exactly for these blocking scenarios.
I managed to do it using Lua. The thing I was making wrong was using require('requests') this is blocking. Ideally for HA never use a Lua external library. I have to deal with plain sockets and do an HTTP request and very important to use HA core method core.tcp() instead of Lua sockets.
While sending soap1.2 request what are the namespaces we need to use in soapbody? Any sample code available in ios programming?
SOAP request namespace start with following prefix.
http://www.w3.org/2003/05/
And depending on the type of element there are suffix. so for eg.
Envelope - http://www.w3.org/2003/05/soap-envelope
Addressing Header - http://www.w3.org/2005/08/addressing
Check This example.
I am requesting OData service like this,
https://www.example.com/part1/part2/_vti_bin/myServiceFolder/MyOdataService.svc
but when it returns xml back...
I am getting this,
"<?xml version="1.0" encoding="utf-8"?><feed
xml:base=https://www.example.com/_vti_bin/myServiceFolder/MyOdataService.svc
What could had caused it ? I am hosting this service in SharePoint web application.
Found answer here,
https://blogs.msdn.microsoft.com/peter_qian/2010/03/23/overwriting-the-service-root-uri-in-wcf-data-service/
Basically it was using host's name or url and constructing response, so I had to overwrite following according to my needs,
OperationContext.Current.IncomingMessageProperties["MicrosoftDataServicesRootUri"] = serviceUri;
OperationContext.Current.IncomingMessageProperties["MicrosoftDataServicesRequestUri"] = requestUri;
I have never used JUnit or other testing frameworks. All i know is how to develop rest service. I recently saw REST assured framework to test REST api. But all the articles that i found looks like below. But i don't know how to pass request xml and how will i get response and when should i call this method.?
Do i need to use some other tool before this REST assured.? I am completely beginner in this kind of testing frameworks. Please show me some light in this world. All i know is how to send request and check values in the response in SOAPUI. I have never tried this.
expect().
statusCode(200).
body(
"user.email", equalTo("test#hascode.com"),
"user.firstName", equalTo("Tim"),
"user.lastName", equalTo("Testerman"),
"user.id", equalTo("1")).
when().
get("/service/single-user/xml");
expect() /* what u expect after sending a request to REST Service */
statusCode(200) /*you are expecting 200 as statuscode which tells request handled successfully at server */
body()
/* the conditions given in body are compare the value with expected values. "equalTo" hamcrest matcher condition (you need to have hamcrest jar in java classpath).*/
when(). /* as is name says above all will be done after sending get/post/put/delete request right so before you put these get,post,put,delete you will have this method as prefix */
get("/service/single-user/xml")
/* the actual REST API request url goes here. can be GET/POST/PUT/DELETE. the confusion for you is its only showing half part which is base path.you can give entire request url in get() method.*/
more on:
http://rest-assured.googlecode.com/svn/tags/1.8.1/apidocs/com/jayway/restassured/RestAssured.html
I hope this helps.
This is how part of my Mule 3.3.0 flow is:
<flow name="soapService">
<http:inbound-endpoint address="${my.service.address}" exchange-pattern="request-response">
<cxf:proxy-service wsdlLocation="classpath:order.wsdl" namespace="http://abc.com/services/order" service="OrderService"
enableMuleSoapHeaders="false">
</cxf:proxy-service>
</http:inbound-endpoint>
...
</flow>
No matter, whatever I specify in my order.wsdl <soap:address location="http://server.com/order">, this is being overwritten by ${my.service.address} value specified in <http://inbound-endpoint address="${my.service.address}">
If I check in my wsdl in classes folder, it has the correct value in location attribute of <soap:address> element but when try to see the wsdl from browser, value is replaced with address of <http:inbound-endpoint>
This is a feature not a bug :)
Because your are using a CXF proxy you want the SOAP address to be rewritten to the inbound HTTP endpoint address so that clients consuming the WSDL exposed by Mule will send SOAP requests through the proxy and not directly to whatever SOAP address was initially in the WSDL.