invoke external webservice in openesb - web-services

I have created a simple webserivce locally.
Imported its wsdl in the bpel project and tried to invoke it.
I tested the webservice directly from the browser and it works fine.
However running the test case in the CA gives me the following error.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>BPCOR-6135: A fault was not handled in the process scope; Fault Name is {http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/ErrorHandling}systemFault; Fault Data is &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;jbi:message xmlns:sxeh=&quot;http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/ErrorHandling&quot; type=&quot;sxeh:faultMessage&quot; version=&quot;1.0&quot; xmlns:jbi=&quot;http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper&quot;&gt;&lt;jbi:part&gt;The server sent HTTP status code 500: Unable to connect&lt;/jbi:part&gt;&lt;/jbi:message&gt;. Sending errors for the pending requests in the process scope before terminating the process instance</faultstring>
<faultactor>sun-bpel-engine</faultactor>
<detail>
<detailText>BPCOR-6135: A fault was not handled in the process scope; Fault Name is {http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/ErrorHandling}systemFault; Fault Data is &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;jbi:message xmlns:sxeh=&quot;http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/ErrorHandling&quot; type=&quot;sxeh:faultMessage&quot; version=&quot;1.0&quot; xmlns:jbi=&quot;http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper&quot;&gt;&lt;jbi:part&gt;The server sent HTTP status code 500: Unable to connect&lt;/jbi:part&gt;&lt;/jbi:message&gt;. Sending errors for the pending requests in the process scope before terminating the process instance
Caused by: BPCOR-6131: An Error status was received while doing an invoke (partnerLink=PartnerLink2, portType={http://testWs/}TestWebService, operation=hello)
BPCOR-6129: Line Number is 44
BPCOR-6130: Activity Name is Invoke1
Caused by: The server sent HTTP status code 500: Unable to connect</detailText>
</detail>
</SOAP-ENV:Fault>

Could you precise the version and the edition you are using.
Could you first use a tools such as SOAP UI to see if your WSDL (concrete part: port, IP) is ok.
Then if the wsdl is ok, What you try to do must work.
Did you have a look on OpenESB documentation ?
www.open-esb.net You must be logged to access to the documentation.
If you don't success try to contact the community on contact#open-esb.net
regards
Paul

Related

How to disable Verbose Error Messages of soap web services?

How to disable Verbose Error Messages of soap web services?
I have one web method with some para.
Example Req:
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<GenerateTestRequest xmlns="http://tempuri.org/">
<sId>1#!aB</sId>
<mobileNum>12345678</mobileNum>
<srcType>1</srcType>
</GenerateTestRequest>
</Body>
</Envelope>
When an unexpected input was supplied into sId para instead of Int32, Then the web service returned an exception within the response content.
Example Res:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:DeserializationFailed</faultcode>
<faultstring xml:lang="en-SG">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:sId. The InnerException message was 'There was an error deserializing the object of type System.Int32. The value '1#!aB' cannot be parsed as the type 'Int32'.'. Please see InnerException for more details.</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>
I don't want to display response content of exception message. Is there any way to turn off stack trace or exception details?
Is there any way to turn off stack trace or exception details?
Yes, by doing proper error handling for the SOAP web service.
A SOAP request can receive back a successful SOAP response or can receive back an unsuccessful response in the form of a SOAP Fault. People unfortunately focus on the successful cases only and let the framework they are using handle other problems.
Because SOAP is a protocol any exception on the server needs to be converted to a proper Fault response. This needs to be done by the developer by catching any exception and building appropriate Fault responses out of them, with only the needed data inside. For security reasons of course that data can't contain stacktraces or others sensitive information. But like I said, people often neglect to handle the error cases, and the framework can't build custom Faults, it can only build a SOAP fault with details from the exception that occurred, exposing it to the client.
You didn't tag this WCF but the schema namespace on the error code says windowscommunicationfoundation so I'll assume that's the web service framework. You can replace all exception messages with a generic error message by setting IncludeExceptionDetailInFaults to false (I think for your service it is set to true right now). See here for details: either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server
Or, you can do proper error handling and define and document the possible Faults a client can receive and convert any exception to one of those Faults. You can start reading here: Specifying and Handling Faults in Contracts and Services
If you are using any other web service framework or library, the idea is the same, the documentation to read will be different.

How to deploy Clojure/Luminus uberwar in Weblogic 12.c

I have created a microservice PoC using Clojure & Luminus web framework and packaged into a WAR via lein uberwar.
It has been tested and it is properly deployed and run in Immutant and Tomcat servers. Our production environment is an Oracle Weblogic 12c. In order to avoid some errors I've created a weblogic.xml file inside the war with the content:
<?xml version='1.0' encoding='UTF-8'?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
<container-descriptor>
<filter-dispatched-requests-enabled>false</filter-dispatched-requests-enabled>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
However I get this internal error as if the server would not detect the entry point of the application.
<Nov 10, 2016 9:25:57 AM UTC> <Warning> <HTTP> <BEA-101162> <User defined listener mu_publisher.listener failed: java.lang.RuntimeException: could not start [#'mu-publisher.handler/init-app] due to.
java.lang.RuntimeException: could not start [#'mu-publisher.handler/init-app] due to
at mount.core$up$fn__4349.invoke(core.cljc:92)
at mount.core$up.invokeStatic(core.cljc:92)
at mount.core$up.invoke(core.cljc:90)
at mount.core$bring.invokeStatic(core.cljc:206)
at mount.core$bring.invoke(core.cljc:198)
Truncated. see log file for complete stacktrace
Caused By: java.lang.IllegalArgumentException: No implementation of method: :enabled? of protocol: #'clojure.tools.logging.impl/Logger found for class: org.slf4j.impl.JDK14LoggerAdapter
at clojure.core$_cache_protocol_fn.invokeStatic(core_deftype.clj:568)
at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:560)
at clojure.tools.logging.impl$fn__51$G__44__58.invoke(impl.clj:16)
at mu_publisher.env$fn__225.invokeStatic(env.clj:7)
at mu_publisher.env$fn__225.invoke(env.clj:6)
Truncated. see log file for complete stacktrace
As an update. I modified the weblogic.xml as:
<?xml version='1.0' encoding='UTF-8'?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
<container-descriptor>
<filter-dispatched-requests-enabled>false</filter-dispatched-requests-enabled>
<prefer-application-packages>
<package-name>org.slf4j</package-name>
<package-name>org.joda.*</package-name>
</prefer-application-packages> </container-descriptor>
So I no longer get the error message. But when I try to access the webapp via http://localhost:8001/mu-publisher, I get an ERROR 500: Something very bad happened, and in the console log's no errors are reflected or printed.

Call Web Service and Return Error in Delphi 7

I have import a WSDL in Delphi 7 and Call a function on it and an error message will be displayed:
Project Project1.exe raised exception class ERemotableException with message 'Server was unable to process request. ---> Validation failed for one or more entities. See 'EntityValidationErrors' property for more details.'. Process stopped. Use Step or Run to continue.
When I call WebService method (in Delphi 7), with Fiddler software I got the message contents(XML) posted :
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><NS1:Save xmlns:NS1="http://tempuri.org/"><from xsi:type="xsd:string">1</from><to xsi:type="xsd:string">2</to><body xsi:type="xsd:string">ServiceTest</body></NS1:Save></SOAP-ENV:Body></SOAP-ENV:Envelope>
And then I call the same method and web service in Delphi XE5 with no error and this XML content :
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><Save xmlns="http://tempuri.org/"><from>1</from><to>2</to><body>ServiceTest</body></Save></SOAP-ENV:Body></SOAP-ENV:Envelope>
SOAP Server Response :
SOAP Web Service write in .NET framework and support SOAP 1.1 and 1.2
Any ideas?
I have use THTTPRIO.OnBeforeExecute for change SOAPResponse.Then delete unnecessary attribute and type in XML source and packing again and assign it to SOAPResponse and send it.
In this method the problem was solved.

Reading web service response using ColdFusion

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header>
<WSResponseHeader xmlns="http://cio.xxx.com/commonheader/v3" xmlns:ns2="http://newhorizon.xxx.com/ABCservice">
<WSCorrelationId>?</WSCorrelationId>
</WSResponseHeader>
</S:Header>
<S:Body>
<ns2:newOrderResponse xmlns="http://cio.XXX.com/commonheader/v3" xmlns:ns2="http://newhorizon.XXXX.com/ABCservice">
<ns2:ABCOrderResponse>
<ns2:headerStatus>ERROR</ns2:headerStatus>
<ns2:lineResponse>
<ns2:sourceSystemRefLineNum>1</ns2:sourceSystemRefLineNum>
<ns2:lineStatus>ERROR</ns2:lineStatus>
<ns2:lineError>
<ns2:errorCode>122</ns2:errorCode>
<ns2:errorMessage>Billing Category Code is required. </ns2:errorMessage>
</ns2:lineError>
</ns2:lineResponse>
</ns2:ABCOrderResponse>
</ns2:newOrderResponse>
</S:Body>
</S:Envelope>
I have a soap web service code in ColdFusion which invokes an external web service and my app will pass some rows to it. The above is the format of response that the application will send back. There can be multiple <ns2:lineResponse> type blocks. Some blocks will have error tags, some may have success tags.
How can I iterate through this response to extract details from error tag blocks only?
When I try to make loops, it is counting <ns2:headerStatus>ERROR</ns2:headerStatus> also as child node.

SOAP web-service - fake a server side error?

my iphone app is using soap web-services. I want to know how it would behave if the web-service returns a soap error?
I am using charles (HTTP Proxy) to catch the responses and modify the response before sending it to my iPhone app. What I'm trying to do is to modify a successful soap response, and turn it into a soap fault to see how my application behave.
QUESTION: How does a SOAP error response look like? (With restful all i had to do was to change the responseCode to 504, how can I achieve this with SOAP)?
How does a SOAP error response look like?
Here's an example of how a failed SOAP response might look like:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header />
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring xml:lang="en-US">The creator of this fault did not specify a Reason.</faultstring>
<detail>
<MyFault xmlns="http://schemas.datacontract.org/2004/07/ToDD" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<MyProperty>some value</MyProperty>
</MyFault>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>
As you can see there's a special <Fault> node in the body of the SOAP response which could contain any XML describing the SOAP fault. The custom XML should be in the <detail> child node.