obtaining OperationType from WSDL model ? [message #36450] |
Tue, 03 August 2004 12:02  |
Eclipse User |
|
|
|
Originally posted by: hoe.zurich.ibm.com
When I parse a WSDL document using code in plugin com.ibm.etools.wsdl
the resulting WSDLResourceImpl looks fine, except that
Operation.getStyle returns null instead one of the 4 valid
OperationTypes. Is this a bug, or how can one distinguish between WSDL
1.1 transmission primitives (esp. request-response and solicit-response)
instead?
Thanks,
Christian
|
|
|
|
|
Re: obtaining OperationType from WSDL model ? [message #36773 is a reply to message #36705] |
Wed, 04 August 2004 03:42  |
Eclipse User |
|
|
|
Originally posted by: hoe.zurich.ibm.com
This is a multi-part message in MIME format.
--------------070809000805060806030808
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Craig,
Thanks & yes, I'll see if I can open a defect. I'm appending my current
workaround method (it's along the very line you're suggesting), which
should perhaps be refactored into OperationImpl.getStyle.
Kihup,
I think the style attribute is different (related to bindings, not
transmission primitives. Terminology overlaps here.
Thanks,
Christian
Craig Salter wrote:
> Actually Christian, this is a bug in our model. Kihup, we should be the
> ones deducing the style here ... we simply need to consider the presense
> and order of the <input> and <output> elements. Christian, please open a
> defect for this problem.
--------------070809000805060806030808
Content-Type: text/plain;
name="getStylt_patch.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="getStylt_patch.txt"
public static OperationType getStyle(Operation operation) {
OperationType style = operation.getStyle();
if (style != null)
return style;
if (!(operation instanceof OperationImpl))
throw new AssertionError();
OperationImpl operationImpl = (OperationImpl)operation;
Element element = operationImpl.getElement();
NodeList childNodes = element.getChildNodes();
boolean passedInput = false, passedOutput = false;
for (int i = 0; i < childNodes.getLength(); i++) {
Node childNode = childNodes.item(i);
if (!(childNode instanceof Element) ||
!WSDLConstants.WSDL_NAMESPACE_URI.equals(childNode.getNamesp aceURI()))
continue;
String localName = childNode.getLocalName();
if ("input".equals(localName))
if (passedOutput)
style = OperationType.SOLICIT_RESPONSE;
else
passedInput = true;
else if ("output".equals(localName))
if (passedInput)
style = OperationType.REQUEST_RESPONSE;
else
;
}
if (style == null)
if (passedInput)
style = OperationType.ONE_WAY;
else if (passedOutput)
style = OperationType.NOTIFICATION;
else
throw new AssertionError();
operation.setStyle(style);
return style;
}
--------------070809000805060806030808--
|
|
|
Powered by
FUDForum. Page generated in 0.09921 seconds