Author |
Message
|
simon.starkie |
Posted: Sat Nov 01, 2008 1:58 pm Post subject: user exception (mapped from WSDL's wsdl:fault construct) |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
We are following the good programming practice described in the following article for dealing with web service exceptions:
http://www.ibm.com/developerworks/xml/library/ws-tip-jaxrpc.html
We use “a checked, user-defined exception (mapped from the WSDL's wsdl:fault construct)” .
Our WSDL has:
<wsdl:fault name="KpSystemException">
<soap:fault name="KpSystemException" use="literal"/>
</wsdl:fault>
The KpSystemException is described earlier in the WSDL as a complex type with several elements.
The web service server application is hosted in Websphere 6.0.
The Java classes for the service were emitted from the WSDL using RAD7.
We specified the JAX-RPC option (i.e. not AXIS which was the other option) .
We also have a web service client Java application for testing the service.
The Java classes for the client were also emitted from the same WSDL using RAD7.
And again, we specified the JAX-RPC option.
The Java client code can successfully catch the KpSystemException. which is de-serialized by the emitted (from WSDL) classes making all the elements within KpSystemException visible to the Java Client application. For example getBusinessfuncAreaName is shown below:
//send request to CM
try
{
EnrollmentResponse resp = mp.enrollMember(rq);
printResponse(resp);
}
catch (KpSystemException e)
{
System.out.println("\nBusinessfuncAreaName" + e.getBusinessfuncAreaName());
}
catch (RemoteException e)
{
System.out.println("RemoteException:" + e.getMessage());
throw e;
}
We really need to use WBI6 as a client to the same web service.
So the same WSDL was used to generate a MessageSet in WBI6.
We use the HttpRequest to call the web service in the usual manner.
The web service intentionally throws a KpSystemException (it’s a test).
And WBI6 receives the expected a SOAP Fault at the Error terminal containing the KpSystemException.
The problem is that the ESQL doesn’t have visibility to any of the KpSystemException elements.
That seems to suggest an MRM problem (i.e. when the WSDL import generated the MessageSet).
And we think the “Detail” node in the SOAP Fault may be causing the problem.
Here is the SOAP Fault response that we captured with soapUI (eviware).:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode xmlns:p612="http://v1.cms_enrollment.mbr_mgmt.hp_admn.svc.kp.org">p612:KpSystemException</faultcode>
<faultstring>org.kp.svc.hp_admn.mbr_mgmt.cms_enrollment.v1.KpSystemException</faultstring>
<detail encodingStyle="">
<p612:KpSystemException xmlns:p612="http://v1.cms_enrollment.mbr_mgmt.hp_admn.svc.kp.org">
<id>9026</id>
<messageInstance/>
<messageCorrId/>
<description>org.kp.svc.hp_admn.mbr_mgmt.cms_enrollment.v1.exceptions.KpAppException</description>
<severity>Low</severity>
<priority>High</priority>
<urgency>High</urgency>
<hostName>CNPTCAM1523271</hostName>
<origMessageId>0</origMessageId>
<origMessageTimestamp>Thu Oct 30 00:00:00 PDT 2008</origMessageTimestamp>
<errorHandling>CMS9999</errorHandling>
<otherInfo>Error Line Number=158</otherInfo>
<targetSystem/>
<businessfuncAreaName>CMS</businessfuncAreaName>
<businessFunction>Enrollment</businessFunction>
<componentName>CMS Member Enrollment WebService</componentName>
<className>org.kp.svc.hp_admn.mbr_mgmt.cms_enrollment.v1.common.ErrorUtil</className>
<functionName>getKpAppException</functionName>
</p612:KpSystemException>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
The above SOAP Fault response seems to comply with the W3C spec for SOAP 1.1 at http://www.w3.org/TR/2000/NOTE-SOAP-20000508/
Section 4.4 SOAP Fault describes the Detail element as follows:
detail
The detail element is intended for carrying application specific error information related to the Body element. It MUST be present if the contents of the Body element could not be successfully processed. It MUST NOT be used to carry information about error information belonging to header entries. Detailed error information belonging to header entries MUST be carried within header entries.
The absence of the detail element in the Fault element indicates that the fault is not related to processing of the Body element. This can be used to distinguish whether the Body element was processed or not in case of a fault situation.
All immediate child elements of the detail element are called detail entries and each detail entry is encoded as an independent element within the detail element.
The encoding rules for detail entries are as follows (see also example 10 ):
1. A detail entry is identified by its fully qualified element name, which consists of the namespace URI and the local name. Immediate child elements of the detail element MAY be namespace-qualified.
2. The SOAP encodingStyle attribute MAY be used to indicate the encoding style used for the detail entries (see section 4.1.1 ).
Other Fault subelements MAY be present, provided they are namespace-qualified.
How do we influence WBI6 to process this SOAP Fault like our Java try/catch client does - so that all the elements are visible to ESQL?
Is this by any chance fixed in WBI6.1 (guess)?
Thank you. |
|
Back to top |
|
 |
rekarm01 |
Posted: Sun Nov 02, 2008 4:19 am Post subject: Re: user exception (mapped from WSDL's wsdl:fault construct) |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
simon.starkie wrote: |
We use the HttpRequest to call the web service in the usual manner.
The web service intentionally throws a KpSystemException (it’s a test).
And [WMB6] receives the expected a SOAP Fault at the Error terminal containing the KpSystemException.
The problem is that the ESQL doesn’t have visibility to any of the KpSystemException elements. |
Any Error message propagated through the HttpRequest.Error terminal is a BLOB.
Did you reparse the SOAP fault as MRM, (or XMLNSC), before trying to access its elements? |
|
Back to top |
|
 |
simon.starkie |
Posted: Mon Nov 03, 2008 11:21 am Post subject: Re: user exception (mapped from WSDL's wsdl:fault construct) |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
rekarm01 wrote: |
simon.starkie wrote: |
We use the HttpRequest to call the web service in the usual manner.
The web service intentionally throws a KpSystemException (it’s a test).
And [WMB6] receives the expected a SOAP Fault at the Error terminal containing the KpSystemException.
The problem is that the ESQL doesn’t have visibility to any of the KpSystemException elements. |
Any Error message propagated through the HttpRequest.Error terminal is a BLOB.
Did you reparse the SOAP fault as MRM, (or XMLNSC), before trying to access its elements? |
Thank you for posting a response.
Yes, we did reparse the SOAP Fault as XMLNSC using a ResetContentDescriptor.
Below is hopefully a clarification of the problem definition. |
|
Back to top |
|
 |
simon.starkie |
Posted: Mon Nov 03, 2008 11:25 am Post subject: |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
The WBI Trace below shows the SOAP Fault that it received from WAS.
The SOAP Fault appears to be correct.
But the ESQL code doesn't have visibility to the elements in KPSystemException custom exception in the SOAP Fault.
So the ESQL is unable to address elements such as severity or hostName etc in the KpSystemException like the aforementioned Java Client try/catch does.
(
(0x01000000):Properties = (
(0x03000000):MessageSet = ''
(0x03000000):MessageType = ''
(0x03000000):MessageFormat = ''
(0x03000000):Encoding = 546
(0x03000000):CodedCharSetId = 1208
(0x03000000):Transactional = FALSE
(0x03000000):Persistence = FALSE
(0x03000000):CreationTime = GMTTIMESTAMP '2008-11-03 19:04:47.996520'
(0x03000000):ExpirationTime = -1
(0x03000000):Priority = 0
(0x03000000):ReplyIdentifier = X'000000000000000000000000000000000000000000000000'
(0x03000000):ReplyProtocol = 'SOAP-HTTP'
(0x03000000):Topic = NULL
(0x03000000):ContentType = 'text/xml; charset=utf-8'
)
(0x01000000):HTTPResponseHeader = (
(0x03000000):X-Original-HTTP-Status-Line = 'HTTP/1.0 500 Internal Server Error'
(0x03000000):X-Original-HTTP-Status-Code = 500
(0x03000000):Date = 'Mon, 03 Nov 2008 19:05:08 GMT'
(0x03000000):Server = 'WebSphere Application Server/6.0'
(0x03000000):Content-Type = 'text/xml; charset=utf-8'
(0x03000000):Content-Language = 'en-US'
(0x03000000):Content-Length = '1418'
)
(0x01000000):XMLNSC = (
(0x01000000)http://schemas.xmlsoap.org/soap/envelope/:Envelope = (
(0x03000102)http://www.w3.org/2000/xmlns/:soapenv = 'http://schemas.xmlsoap.org/soap/envelope/'
(0x03000102)http://www.w3.org/2000/xmlns/:soapenc = 'http://schemas.xmlsoap.org/soap/encoding/'
(0x03000102)http://www.w3.org/2000/xmlns/:xsd = 'http://www.w3.org/2001/XMLSchema'
(0x03000102)http://www.w3.org/2000/xmlns/:xsi = 'http://www.w3.org/2001/XMLSchema-instance'
(0x01000000)http://schemas.xmlsoap.org/soap/envelope/:Header =
(0x01000000)http://schemas.xmlsoap.org/soap/envelope/:Body = (
(0x01000000)http://schemas.xmlsoap.org/soap/envelope/:Fault = (
(0x03000000):faultcode = 'p612:KpSystemException'
(
(0x03000102)http://www.w3.org/2000/xmlns/:p612 = 'http://v1.cms_enrollment.mbr_mgmt.hp_admn.svc.kp.org'
)
(0x03000001):faultstring = 'org.kp.svc.hp_admn.mbr_mgmt.cms_enrollment.v1.KpSystemException'
(0x01000000):detail = (
(0x03000100):encodingStyle = ''
(0x01000000)http://v1.cms_enrollment.mbr_mgmt.hp_admn.svc.kp.org:KpSystemException = (
(0x03000102)http://www.w3.org/2000/xmlns/:p612 = 'http://v1.cms_enrollment.mbr_mgmt.hp_admn.svc.kp.org'
(0x03000000):id = '7848'
(0x01000000):messageInstance =
(0x01000000):messageCorrId =
(0x03000000):description = 'org.kp.svc.hp_admn.mbr_mgmt.cms_enrollment.v1.exceptions.KpAppException'
(0x03000000):severity = 'Critical'
(0x03000000):priority = 'High'
(0x03000000):urgency = 'High'
(0x03000000):hostName = 'CNPTCAM1523271'
(0x03000000):origMessageId = 'EU'
(0x03000000):origMessageTimestamp = 'Tue Jan 08 00:00:00 PST 2008'
(0x01000000):errorHandling =
(0x03000000):otherInfo = 'Error Line Number=158'
(0x01000000):targetSystem =
(0x03000000):businessfuncAreaName = 'CMS'
(0x03000000):businessFunction = 'Enrollment'
(0x03000000):componentName = 'CMS Member Enrollment WebService'
(0x03000000):className = 'org.kp.svc.hp_admn.mbr_mgmt.cms_enrollment.v1.common.ErrorUtil'
(0x03000000):functionName = 'getKpAppException'
)
)
)
)
)
)
) |
|
Back to top |
|
 |
rekarm01 |
Posted: Mon Nov 03, 2008 2:11 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
simon.starkie wrote: |
The WBI Trace below shows the SOAP Fault that it received from WAS.
The SOAP Fault appears to be correct.
But the ESQL code doesn't have visibility to the elements in KPSystemException custom exception in the SOAP Fault.
So the ESQL is unable to address elements such as severity or hostName etc in the KpSystemException like the aforementioned Java Client try/catch does. |
Can you explain in more detail what you mean by "ESQL code doesn't have visibility"?
It might be helpful to post the portion of ESQL that's not working as expected, and describe what it does instead.
I'm able to access the severity or hostName elements in your KpSystemException, using ESQL similar to this:
Code: |
DECLARE ns NAMESPACE 'http://v1.cms_enrollment.mbr_mgmt.hp_admn.svc.kp.org';
DECLARE soapenv NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
CREATE COMPUTE MODULE TestCMS_MemEnrollSrv_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
SET OutputRoot = InputRoot;
IF OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.severity IS NOT NULL THEN
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.hostName
= LCASE(InputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.hostName);
END IF;
RETURN TRUE;
END;
END MODULE; |
|
|
Back to top |
|
 |
simon.starkie |
Posted: Mon Nov 03, 2008 3:15 pm Post subject: |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
rekarm01 wrote: |
simon.starkie wrote: |
The WBI Trace below shows the SOAP Fault that it received from WAS.
The SOAP Fault appears to be correct.
But the ESQL code doesn't have visibility to the elements in KPSystemException custom exception in the SOAP Fault.
So the ESQL is unable to address elements such as severity or hostName etc in the KpSystemException like the aforementioned Java Client try/catch does. |
Can you explain in more detail what you mean by "ESQL code doesn't have visibility"?
It might be helpful to post the portion of ESQL that's not working as expected, and describe what it does instead.
I'm able to access the severity or hostName elements in your KpSystemException, using ESQL similar to this:
Code: |
DECLARE ns NAMESPACE 'http://v1.cms_enrollment.mbr_mgmt.hp_admn.svc.kp.org';
DECLARE soapenv NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
CREATE COMPUTE MODULE TestCMS_MemEnrollSrv_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
SET OutputRoot = InputRoot;
IF OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.severity IS NOT NULL THEN
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.hostName
= LCASE(InputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.hostName);
END IF;
RETURN TRUE;
END;
END MODULE; |
|
Thanks, that worked.
I used:
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.hostName
= 'NewHostValue';
And got the desired result.
But...
If I enter an incomplete version of the ESQL statement
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.
and then try to use Ctrl-SpaceBar (AutoComplete)
this does not show me any of the element choices that are available in KpSystemException,
including hostName
Can you explain why?
Thanks. |
|
Back to top |
|
 |
simon.starkie |
Posted: Mon Nov 03, 2008 3:42 pm Post subject: |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
ps
Regarding the auto-complete not showing any of the KpSystemException element choices...
the flip-side to this behavior is that it makes it possible to introduce invalid elements, such as hostNameBAD for example, which is not a valid element for KpSystemException and may cause other problems later (schema validation back on WAS, assuming WAS doesn't run into a problem de-serializing the hostNameBAD element because it's not in the WSDL or emitted classes). |
|
Back to top |
|
 |
rekarm01 |
Posted: Tue Nov 04, 2008 12:06 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
simon.starkie wrote: |
If I enter an incomplete version of the ESQL statement
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.
and then try to use Ctrl-SpaceBar (AutoComplete)
this does not show me any of the element choices that are available in KpSystemException,
including hostName
Can you explain why?
Thanks. |
Toolkit "AutoComplete" doesn't work with XMLNSC.
If you want that, you need to use MRM instead. |
|
Back to top |
|
 |
simon.starkie |
Posted: Tue Nov 04, 2008 9:06 am Post subject: |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
rekarm01 wrote: |
simon.starkie wrote: |
If I enter an incomplete version of the ESQL statement
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.
and then try to use Ctrl-SpaceBar (AutoComplete)
this does not show me any of the element choices that are available in KpSystemException,
including hostName
Can you explain why?
Thanks. |
Toolkit "AutoComplete" doesn't work with XMLNSC.
If you want that, you need to use MRM instead. |
Sorry, the correct nomenclature I should have ued for Ctrl+Space is "Content Assist"
I tried using MRM instead of XMLNSC and fount it is even less successful at building the ESQL statement.
With MRM Content Assist only gets as far as MRM. and then nothing after that.
SET OutputRoot.MRM.
I have a ResetContentDescriptor wired to the Error terminal of the HTTP Request Node.
The ResetContentDescriptor has:
Message domain = to MRM : For binary, text or XML messages (namespace aware, validation, low memory use)
Reset message domain = checked
Message set = MDESimulatorMessageSet (EIR443S002001)
Reset message set = checked
Message type = blank (i.e. not set...I've tried XML but no difference)
Reset message type = checked
Message format = blank (i.e. not set...I've tried XML1 but no difference)
Reset message format = checked |
|
Back to top |
|
 |
simon.starkie |
Posted: Tue Nov 04, 2008 2:13 pm Post subject: |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
First, I want to say thanks for all the help and suggestions.
Second, I think I want to let this one go now.
I've got what I wanted ...
"Explicitly declaring faults in WSDL operations, like explicitly declaring exceptions in Java methods, is good programming practice."
The Content Assist issue is an anoyance that I'm sure will be fixed one day.
Meanwhile, the good ship Venus can proceed steadily towards nirvana
Cheers! |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 04, 2008 2:35 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
rekarm01 said:
Quote: |
Toolkit "AutoComplete" doesn't work with XMLNSC. |
This is wrong advice. In the toolkit, message sets work with all domains, and it is best practice to create and use them.
Quote: |
If I enter an incomplete version of the ESQL statement
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.
and then try to use Ctrl-SpaceBar (AutoComplete)
this does not show me any of the element choices that are available in KpSystemException,
including hostName |
The correct answer is that auto-complete works off message definitions. The message definitions are discovered via the project references in your message flow project. So you need to ensure that:
- You have a message set which contains the definition of KpSystemException
- That message set is referenced from your message flow project
- Element 'KpSystemException' is either declared explicitly as a child of soapenv:Fault.detail or else it is declared as a global element ( so that it matches an xs:any in the definition of soapenv:Fault.detail ) |
|
Back to top |
|
 |
simon.starkie |
Posted: Tue Nov 04, 2008 3:03 pm Post subject: |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
kimbert wrote: |
rekarm01 said:
Quote: |
Toolkit "AutoComplete" doesn't work with XMLNSC. |
This is wrong advice. In the toolkit, message sets work with all domains, and it is best practice to create and use them.
Quote: |
If I enter an incomplete version of the ESQL statement
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.soapenv:Fault.detail.ns:KpSystemException.
and then try to use Ctrl-SpaceBar (AutoComplete)
this does not show me any of the element choices that are available in KpSystemException,
including hostName |
The correct answer is that auto-complete works off message definitions. The message definitions are discovered via the project references in your message flow project. So you need to ensure that:
- You have a message set which contains the definition of KpSystemException
- That message set is referenced from your message flow project
- Element 'KpSystemException' is either declared explicitly as a child of soapenv:Fault.detail or else it is declared as a global element ( so that it matches an xs:any in the definition of soapenv:Fault.detail ) |
Thanks Kimbert.
1. Yes, I know. otherwise, it wouldn't even have got as far as finding KpSystemException, would it.
And I'm glad to hear using Content Assist is a best practice.
That is what we are trying to accomplish here.
2. May I please I mail you my WSDL and have you look at the emitted MessageSet please?
It's rather large and I'd prefer not to paste it in this topic.
Also, this particular WSDL started life in BizTalk.
Meaning it doesn't follow the usual best practice of inheriting the elements from a Schema in the normal manner.
But rather has all elements defined "inline" in the WSDL as is Microsoft's habit.
So I'd rather not have someone here see that and think it's a good approach when it isn't.
Thanks. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 04, 2008 3:12 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Sorry, I missed the fact that it is finding KpSystemException. That makes the symptoms even harder to explain. Instead of supplying your entire message set, please paste the portion(s) of the message definition file which define(s) element 'KpSystemException' and its complex type. |
|
Back to top |
|
 |
simon.starkie |
Posted: Tue Nov 04, 2008 3:44 pm Post subject: |
|
|
Disciple
Joined: 24 Mar 2002 Posts: 180
|
kimbert wrote: |
Sorry, I missed the fact that it is finding KpSystemException. That makes the symptoms even harder to explain. Instead of supplying your entire message set, please paste the portion(s) of the message definition file which define(s) element 'KpSystemException' and its complex type. |
Yes, that's why I thought you would be better off with a copy of the WSDL.
*EDIT*
Removed overweight, fat, cluttering schema file below.
Last edited by simon.starkie on Fri Nov 21, 2008 8:29 am; edited 1 time in total |
|
Back to top |
|
 |
rekarm01 |
Posted: Tue Nov 04, 2008 5:26 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
kimbert wrote: |
rekarm01 said:
Quote: |
Toolkit "AutoComplete" doesn't work with XMLNSC. |
This is wrong advice. In the toolkit, message sets work with all domains, and it is best practice to create and use them. |
Yes, that was wrong advice.
In a message set project, you can open "messageSet.mset", and set the "Message Set"->"Message Domain" property.
It seems that Content Assist will auto-complete ESQL references when the domain specified by the ESQL reference agrees with the domain specified in the message sets "Message Domain" property.
It also seems that Content Assist will fail to auto-complete ESQL references, otherwise. |
|
Back to top |
|
 |
|