If a POST request requires that i send four data elements in the body, like:
{
"name":abc,
"surname":xyz,
"contact_no":1234,
"address":random_value
}
What will happen if I miss out some of the elements, for example if I call the web service with elements like,
{
"name":abc,
"surname":xyz,
}
What error is the server likely to throw ? I am having this issue because I am making a API call and it's giving me a HTTP error 500, so I guess it's not an error on my part, but this is one doubt i wanted to clear. Thanks in advance.
Its depends on the service structure (if all fields are mandatory or not),
and HTTP error (500) returns to server error or (server or link) not found .
I am using SOAPUI v4.6.4.
I am testing REST SOAPUI test. I have the media type set to application/json.
I am trying to pass this value as part of JSON string and I get 404 server error.
{"enteredTime":"2001-12-17T09:30:47+05:00"}
It is having issues with + sign.
I tried encoding it as 2001-12-17T09%3A30%3A47%2B05%3A00. The 404 server is gone but the application code is NOT expecting the encoded value.
Any solutions are highly appreciated.
I have an iOS app using Restkit. Most of the response bodies from the server are in XML format. However, there is a few API's that will only send a response like "Success" in text/plain format. When calling these API's I get a 200 response but restkit will throw a mapping error because it is expecting Content-Type = application/xml as is seen in the error below.
NSLocalizedDescription=Loaded an unprocessable response (200) with content type 'application/xml'} response.body=success
I am using the RKXMLReaderSerialization class to interpret the XML received from the server and this is how I register it.
[RKMIMETypeSerialization registerClass:[RKXMLReaderSerialization class] forMIMEType:#"application/xml"];
It appears from the documentation you can register multiple MIMETypes but I haven't been able to figure out how. If that is possible can someone point it out to me. If not is there a way to handle this?
UPDATE/SOLUTION
After further research and help from Wain I discovered the error above was actually stating that the response-header for content-type had a value of application/xml. This keyed restkit to try and map the response.body as an application/xml formatted body. With a response.body containing only the word "success" the response was unprocessable. I ended up pointing this out to my server guy and he corrected the response to be formatted in the MIMEType declared by the Accept header sent with the request.
You can call setAcceptHeaderWithMIMEType: on your RKObjectManager to tell it what mime types are acceptable in the response. You may need to define and register your own serialisation class too so that RestKit can execute the whole mapping workflow without errors.
I have a custom ServiceAuthorizationManager implemented in wcf webhttp service to do api key verification. It sends a webfaultexception with the code 403 if the key is invalid.
But the issue is, when the exception is thrown, it s always send to the client as xml.
The service accepts both JSON and XML and it s working fine for all the other operations except for the exception from the manager.
No matter if I set the accept header or content type the result is always xml. But for other requests, the response type switches perfectly according to the content-type header
Here's the web.config
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
Any help is really appriciated.
If anyone else ran into this issue: looks like no way to fix it. The solution I did was to do the verification in the service's constructor. Make sure the instance context mode is set to per call.
More info http://amilagm.com/2012/04/better-way-to-do-api-key-verification-in-wcf-webhttp-services/
I have been struggling with the following error the last couple of
days can you please help!
I generated my server and client code using the wsdl2java tool from a
wsdl 2.0 file.
When invoking the webservice I am getting the following error:
org.apache.axis2.AxisFault: The endpoint reference (EPR) for the
Operation not found is
/axis2/services/MyService/authentication/?username=Denise345&password=xxxxx
and the WSA Action = null
My service is displayed on the axis2 webpage with all available methods.
Here is the output from TcpMon
==============
Listen Port: 8090
Target Host: 127.0.0.1
Target Port: 8080
==== Request ====
GET /axis2/services/MyService/authentication/?username=Denise345&password=xxxxx
HTTP/1.1
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
SOAPAction: ""
User-Agent: Axis2
Host: 127.0.0.1:8090
==== Response ====
HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: application/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 12 May 2011 15:53:20 GMT
Connection: close
12b
<soapenv:Reason xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Text xml:lang="en-US">The endpoint reference (EPR) for the
Operation not found is
/axis2/services/MyService/authentication/?username=Denise345&password=xxxxx
and the WSA Action = null</soapenv:Text></soapenv:Reason>
0
==============
I am using:
axis2-1.5.4
Tomcat 7.0.8
wsdl 2.0 file
Please help!
In my case it was caused by a wrong Content-Type in the HTTP POST. Setting it to text/xml solved the problem.
Try adding ?wsdl to the string.
As described by Eran Chinthaka at http://wso2.com/library/176/
If Axis2 engine cannot find a service and an operation for a message,
it immediately fails, sending a fault to the sender. If service not
found - "Service Not found EPR is " If
service found but not an operation- "Operation Not found EPR is and WSA Action = "
In your case the service is found but the operation not. The Axis2 engine uses SOAPAction in order to figure out the requested operation and, in your example, the SOAPAction is missing, therefore I would try to define the SOAPAction header
It happens because the source WSDL in each operation has not defined the SOAPAction value.
e.g.
<soap12:operation soapAction="" style="document"/>
His is important for axis server.
If you have created the service on netbeans or another, don't forget to set the value action on the tag #WebMethod
e.g. #WebMethod(action = "hello", operationName = "hello")
This will create the SOAPAction value by itself.
Action is null means that no Action in given SOAP Message (Request XML). You must set Action before SOAP call:
java.net.URL endpoint = new URL("<URL>"); //sets URL
MimeHeaders headers = message.getMimeHeaders(); // getting MIME Header
headers.addHeader("SOAPAction", "<SOAP Action>"); //add Action To Header
SOAPMessage response = soapConnection.call(<SOAPMessage>, endpoint); //then Call
soapConnection.close(); // then Close the connection
I had this same problem using curl to send a soap request. Solved it by adding "content-type: text/xml" to the http header.
I hope this helps someone.
This error is coming because while calling the service, it is not getting the WSDL file of your service.
Just check whether WSDL file of your service is there--> run server and from browser run axis 2 apps on local host and check the deployed services and click on your service, then it shows WSDL file of your service.....or check the service path in your client file.
I hope it may help you to resolve the problem.
This can be solved by disabling validation
<proxy>
<!-- . . . -->
<parameter name="disableOperationValidation">true</parameter>
</proxy>
Late answer but:
I see you do a GET - should be a POST ?
try removing the extra '/' after the operation name (authentication) when invoking through the client
/axis2/services/MyService/authentication?username=Denise345&password=xxxxx
It seems don't find wsdl file..
I've solved adding wsdlLocation parameter at javax.jws.WebService annotation
By removing cache wsdl-* files in /tmp folder, my problem was solved
see https://www.drupal.org/node/1132926#comment-6283348
be careful about permission to delete
I'm in ubuntu os
On Websphere Application Server, in the same situation, it helped deleting the Temp folders while the server was stopped.
I ran into the situation when the package of the service changed.
Open WSDL file and find:
<soap:operation soapAction="[actionNameIsHere]" style="document"/>
Add to the requests header [request send to service]:
'soapAction' : '[actionNameIsHere]'
This work for me.
For devs. using node-soap [ https://github.com/vpulim/node-soap ] - example:
var soap = require('soap');
var options = {
...your options...
forceSoap12Headers: true
}
soap.createClient(
wsdl, options,
function(err, client) {
if(err) {
return callBack(err, result);
}
client.addHttpHeader('soapAction', '[actionNameIsHere]');
...your code - request send...
});
I got this error because the SOAP request I was sending to the server was malformed and had an empty Body
In this case the error message from the server is misleading and can be solved changing the request content, without changing anything about operations, URLs, WSDL, etc