CXF Jax-RS server service returning only header but no response JSON - rest

I have a very basic Rest Server which returns JSON object. I tested it with Poster Firefox extension and I get both header and response.
But we have a test javascript client, which calls the service and when checked with Firebug, we see there is a header but no response.
To be sure, we tested the client with another JSON server and the client can read both the header and response.
As I mentioned, it is a very basic Apache CXF, Jax-RS service, so we are not sure what could be missing , that prevents from sending response or prevents client from reading response.
Will appreciate any help or input.
thank you
Walker

It wasn't the server it was the client which was not able to read the response properly.

Related

What's the difference between receiving data by SOAP header and SOAP body?

I would like what happen when an web service receive part of data by SOAP header. What's the diference between receive data by SOAP header and SOAP body (Before the web service receive all of data by SOAP body)
I don't understand at all what are benefits of this new version.
PD: My web service is based on Java with JAX-WS
Thanks a lot.
Same as any request SOAP has header and body. generally SOAP has all data in body.
Body is highly documented so you can not send additional data in SOAP body.
If you are doing It may break the other end code(Implementation in different for different technologies).
SO if you want to send additional data in SOAP without effecting the WSDL you can use SOAP header.
Headers are like to send additional information.
these header and values can be accessed from message context.
to access these value code may vary from technology to technology

What is http text post in webservice context?

I am having confusion around http text 'post' in terms of webservice context. We are having a web service which is built on SOAP protocol, now the integration partner wants to eliminate the SOAP portion of the XML message and wants us to post XML message as 'http text post'.
Is this REST HTTP POST? Please clarify.
POST is an HTTP request method, of which there are many (ex. GET, PUT, DELETE, HEAD...). POST is used to submit data to a server for processing, whereas GET (for example) is used to retrieve data for reading. You can read more here. These methods are used for all HTTP communication, whether the target is a SOAP/REST web service or an Apache server hosting a regular website.
SOAP normally operates using POST requests, although it is possible to use GET with SOAP 1.2 as well. GET requests have more restrictive size limitations than POST requests.

XML Validation in REST Services

I am going to develope REST(without any framework like SPRING) services which can accept xml. I am going to create XSD for the input xml format.
Now, when client sends some invalid xml which is not as per schema, how should i validate it? Do i need to write a specific code to validate. Can't it get failed in the client side itself?
Previously we had soap service, so if i try to send soap request which is not as per schema, soapui will throw error. The request even will not come to server i guess.
I hope you understood my question, please clarify.
RESTful clients are free to transmit any content they wish to the server, and even try to negotiate different encoding formats like JSON instead of XML. That's part of the power of REST.
It's up to the server to validate that clients send correctly encoded data in the payload, and return a 400-range status code such as 400 - Bad Request if they do not.
You will need to write all your server validation code yourself unless the REST API framework on the server side provides it for you.

soap header between c#.net client and php server

i have a web service written in php, i added it as web reference to my asp.net web site (asp,c#)
i knew how to call web service's method from c#.net client,
but the problem i still have: i want to send a soap header with web service call (from c#.net client to php server)
i did this but in php client, by using $client->setHeaders, and parsed the sending header in $server,
but how to do it in c#.net client,
note: i don't have a header class in server.php , ant it works fine with php
please help
Use WCF custom headers to fill in extra information to pass along to php.
http://cisforcoder.wordpress.com/2010/12/01/how-to-implement-basic-http-authentication-in-wcf-on-windows-phone-7/
This example in the link passes along the header for Authorization
If you make a web reference to the php service, then I can point to the person who already asked it before here on the forum.
Adding SOAP headers to ASMX service requests
If you are using nuSoap, you can go the library, you'll find the code where packet response is been generated. There you can add your own attributes and headers as per your requirement.

Query about SOAP and HTTP fundamentals

Is a client SOAP request simply the use of HTTP POST to send a correctly formatted HTTP header followed by the correctly formatted XML SOAP content to the web service server over a TCP/IP socket connection and then waiting for and parsing the response?
Is it this 'simple' or is there more going on behind the scenes?
I ask because of difficulty using gSOAP with C++ for multiple WSDL files and am considering writing a client from scratch.
SOAP can be used over any transport protocol like TCP, HTTP, SMTP etc with HTTP being the most popular.
SOAP over HTTP basically translates to a valid POST HTTP request with a SOAP envelope inside it, there where the form parameters would have been if we were to talk about a classic POST from the browser. The response body also contains a SOAP envelope, there where you would expect the HTML to be as response to the request from the browser.
You just have to use the proper content type for the SOAP version you are using (text/xml for SOAP 1.1 and application/soap+xml for SOAP 1.2) and maybe specify the SOAPAction header if needed (for SOAP 1.1), but that's about it as HTTP communication is concerned.
Then the receiver of the envelope (be it the server on a request or the client on a response) must make use of the SOAP message, but this has nothing to do with HTTP any more, HTTP just got the message there.