WSDL format error from WSDLReader
tangblack Oct 8, 2012 5:31 AMI write a BPM process to call webservice but get the exception when jBoss 7 tries to inital switchyard service (0.6.0-snapshot).
console
Caused by: org.switchyard.extensions.wsdl.WSDLReaderException: Service operations on a WSDL interface must have exactly one parameter. at org.switchyard.extensions.wsdl.WSDLReader.getParts(WSDLReader.java:182) at org.switchyard.extensions.wsdl.WSDLReader.readWSDL(WSDLReader.java:96) at org.switchyard.extensions.wsdl.WSDLService.fromWSDL(WSDLService.java:99) at org.switchyard.extensions.wsdl.WSDLService.fromWSDL(WSDLService.java:82) at org.switchyard.deploy.internal.Deployment.loadServiceInterface(Deployment.java:363) ... 10 more
In my wsdl file (you can check the attached file), there are three parts under a message like below.
EDI_Import_Ethan_SPort.wsdl
<?xml version='1.0' encoding='UTF-8'?> <WL5G3N0:definitions name="EDI_Import_Ethan_S" targetNamespace="http://ct01/EDI_Import_Ethan_S.wsdl" xmlns="" xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/" xmlns:WL5G3N1="http://www.w3.org/2001/XMLSchema" xmlns:WL5G3N2="http://ct01/EDI_Import_Ethan_S.wsdl" xmlns:WL5G3N3="http://schemas.xmlsoap.org/wsdl/soap/"> <WL5G3N0:types/> <WL5G3N0:message name="EDI_Import_Ethan_S_ctcEcProSoImportAll"> <WL5G3N0:part name="pWfId" type="WL5G3N1:decimal"/> <WL5G3N0:part name="pOut_out" type="WL5G3N1:string"/> <WL5G3N0:part name="pRef_out" type="WL5G3N1:string"/> </WL5G3N0:message> ...
WSDLReader only allows one part under one message so that's why I get the WSDLReaderException.
WSDLReader.java
/** * Parse a definition element and return all message parts defined in it. * * @param defEl the definition element. * @param namespaces a map of namespaceURIs * @return a map of message parts. * @throws WSDLReaderException if the wsdl operation is improper */ private Map<QName, QName> getParts(final Element defEl, final Map<String, String> namespaces) throws WSDLReaderException { NodeList messages = defEl.getElementsByTagNameNS(MESSAGE.getNamespaceURI(), MESSAGE.getLocalPart()); int msgSize = messages.getLength(); Map<QName, QName> parts = new HashMap<QName, QName>(); for (int i = 0; i < msgSize; i++) { Element msgEl = (Element) messages.item(i); NodeList partEls = msgEl.getElementsByTagNameNS(PART.getNamespaceURI(), PART.getLocalPart()); if (partEls.getLength() != 1) { // !! There are 3 parts under the message tag !! throw new WSDLReaderException("Service operations on a WSDL interface must have exactly one parameter."); } Element partEl = (Element) partEls.item(0); parts.put(getQName(msgEl.getAttribute(ATTR_NAME), namespaces), getQName(partEl.getAttribute(ATTR_ELEMENT), namespaces)); } return parts; }
I check http://www.w3.org/TR/wsdl , multiple parts under the message should be proper in WSDL 1.1 .
Example from http://www.w3.org/TR/wsdl
<message name="GetTradePriceInput"> <part name="tickerSymbol" element="xsd:string"/> <part name="time" element="xsd:timeInstant"/> </message>
Could you explain why WSDLReader does this limit?
Because this wsdl file is generated by other provider, how could I parse this wsdl without changing it?
Thanks in advance!
-
EDI_Import_Ethan_SPort.wsdl.zip 727 bytes