System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: Internal Error (from client) faultcode=env:Client faultactor= - api

I'm getting the following response when invoking webservice even after passing all required parameters. Can someone help me how to resolve this error, any info will be helpful.
The error text is:
"System.CalloutException: Web service callout failed: WebService returned a
SOAP Fault: Internal Error (from client) faultcode=env:Client faultactor="

Check if the WSDL has a sequence element; if so, you need to ensure the parameters are in the order defined by that element.
https://w3schools.com/xml/el_sequence.asp

Related

customize FaultException error

I created a wcf service and I'm using FaultException to throw errors to the client, however in client when I call the operation and there is an error in the server I get this kind of error message:
Error message snapshot
I only want the highlighted error message not this html page! I have to find the error by javascript and it's not like a best practice, I want to return only error to client.
thanks for your help

OSB - Is there a way to generate default errors for internal errors?

I have a validate action in the OSB request pipeline which raises an error if the request is not according the schema.
In the error handler, I remove the header info and add some required header info before replying with a failure. However the response I get is the request body and not the fault which is in $fault. Is there a way to have OSB generate a standard soapFault using the $fault variable instead of having to manually create the error response body?
I'm having the same issue with the general error handler defined for the business service and the pipeline error handler when internal errors are raised.
Additionally, Is there a best-practice on how this is usually done for normal services and in case of passthrough services?
thanks

invoke web service with authentication headers in ode bpel

I'm using eclipse bpel designer and trying to invoke a external service which requires authentication headers to be passed.
Here is what I have done
1. Created a headers.endpoint file with the following content
*alias.sample_ns="http://sample.com"
sample_ns.serviceName.portName.ode.http.default-headers.username=system
sample_ns.serviceName.portName.ode.http.default-headers.password=admin*
Placed it in ..\webapps\ode\WEB-INF\processes\$process folder
When I invoke the service I'm getting the following error
"Error sending message (mex={PartnerRoleMex#hqejbhcnphrckf492s9n9b [PID {http://createReservation}CreateReservation-1541] calling org.apache.ode.bpel.epr.WSAEndpoint#1e1f4b8.saveRecord(...) Status ASYNC}): Transport error: 401 Error: Unautho".
I think I need to add header information when invoking the service in BPEL process as well. But couldn't find the way to do it. How can it be done, if this is actually what I'm missing? Or is there something else to be done?
Thanks in advance
Note: HTTP Auth information cannot be set in the *.endpoint files.
For invoking HTTP Service
Testcase will show you how to do it
https://github.com/apache/ode/tree/ode-1.3.x/axis2-war/src/test/resources/TestEndpointProperties
Add message part in WSDL as shown here
https://github.com/apache/ode/blob/ode-1.3.x/axis2-war/src/test/resources/TestEndpointProperties/Echo.wsdl#L66
Assign credentials in Process
https://github.com/apache/ode/blob/ode-1.3.x/axis2-war/src/test/resources/TestEndpointProperties/test-endpoint-properties.bpel#L73
For invoking Soap Service
http://ode.apache.org/http-authentication.html

How to properly handle Axis2 generated exceptions with a REST client

I am using Axis2 v1.6.1 and Resty as a rest client. If I purposely send a malformed request that Axis2 cannot parse, for example, sending "p=0.0" where p is an Integer, then Axis2 will generate 500 HTTP Response and log an error in it's log saying something to the effect of:
[ERROR] Exception occurred while trying to invoke service method createUpdateOrganization
org.apache.axis2.AxisFault: Invalid value "0.0" for element poStart
...
This is great but I need to be able to capture this exception information in order to act upon it as part of our exception management framework.
It seems to be throwing an AxisFault exception but this is before it reaches my service so I'm not sure what I need to configure in order to get this information.
Any ideas?
I found the following article:
http://www.packtpub.com/article/handler-and-phase-in-apache-axis
Which explains exactly what I need to do. The answer is to create a custom handler for the InFaultFlow phase. :) I hope this helps somebody else!

Should my WCF webservice return a 500 or 200 http code (soap fault / functional return message)

after reading the SOAP 1.1 specs, it states that a SOAP Fault should return a http 500 errorcode when communication goes over a http binding, so when a SoapException is thrown, WCF returns a http 500 error code.
Now, I'm looking for some best practices to when return a functional soap error message and when to return a SOAP Fault.
What would you guys return when a functional error occurred while processing the message because of the input message contains some functional errors, a 500 SOAP Fault or a 200 Soap response containing some error message ?
http://www.ws-i.org/Profiles/BasicProfile-1.1-2006-04-10.html#HTTP_Server_Error_Status_Codes:
3.4.7 HTTP Server Error Status Codes
HTTP uses the 5xx series of status codes to indicate failure due to a server error.
R1126: An INSTANCE MUST return a "500 Internal Server Error" HTTP status code if
the response envelope is a Fault.
UPDATE:
What would you guys return when a
functional error occurred while
processing the message because of the
input message contains some functional
errors, a 500 SOAP Fault or a 200 Soap
response containing some error message
?
If the input message is invalid and prevents your service from doing its intended job, then yes - this clearly constitutes an exception, so I would return a SOAP fault in this case (something like FaultException<InvalidInputParameters>).
And I would let WCF handle all the necessary gory details of whether or not and when to return what http error code, if necessary. WCF already does all of that for you - you just throw a SOAP fault in your service code and that's all there is for you.