- This topic has 1 reply, 1 voice, and was last updated 16 years, 5 months ago by Russ.
-
AuthorPosts
-
RussMemberI am hoping someone can point me in the right direction….
What I have is a WSDL created for an external X-Fire Web Service. I have taken this WSDL and created a JAX-WS client for calling the external web service. I have the Web Service deployed on Tomcat. I can hit the WSDL by typing the URL in my browser.
When I created the JAX-WS client from the WSDL, it validates with no errors. All the classes are created in the client. Now I am trying to call one method. When I make the call, I receive: “java.lang.Error: Undefined operation name <method name>.” When I go look at the PortType interface, I see the web method is defined. When I turn on the TCP/IP Montor, I see the WSDL is being pulled down.
My Client code looks like this……
public static void main(String[] args){ MyWebServicePortType client = new MyWebService().getMyWebServiceHttpPort(); ObjectFactory of = new ObjectFactory(); MyFileSearchCriteria criteria = of.createMyFileSearchCriteria(); criteria.setMyCollection(of.createMyCollectionName("Test")); logger.debug("Criteria: " + criteria.toString()); ArrayOfMyFile files = client.searchMyFiles(criteria); logger.debug("Array of My Files: " + files.toString()); }
This is the stack trace:
java.lang.Error: Undefined operation name SearchMyFiles at com.sun.xml.ws.model.JavaMethodImpl.freeze(JavaMethodImpl.java:327) at com.sun.xml.ws.model.AbstractSEIModelImpl.freeze(AbstractSEIModelImpl.java:97) at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:268) at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:633) at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:328) at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:311) at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:304) at javax.xml.ws.Service.getPort(Service.java:92)
I have done some searching in the PortType Interface and it appears the annotations may have something to do with this issue. I modified the operationName to searchMyFiles and I was able to get by the error. However, all it did was move to the next error.
The original @WebMethod looks like this:
@WebMethod(operationName = "SearchMyFiles") @WebResult(name = "out", targetNamespace = "http://service.server.my.project.company.com") @RequestWrapper(localName = "SearchMyFilesRequest", targetNamespace = "http://service.server.my.project.company.com", className = "mil.project.my.client.SearchMyFiles") @ResponseWrapper(localName = "SearchMyFilesResponse", targetNamespace = "http://service.server.my.project.company.com", className = "mil.project.my.client.SearchMyFilesResponse")
My understanding is the @WebMethod should possess the operation name as defined in the WSDL. I have verified this and It does. However for some reason, the getPort method starts the binding operation for the interface and it fails……
When I go look at the log file for MyEclipse I see this SAX Parser exception….
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'ns1:ArrayOfUrgency' to a(n) 'type definition' component. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:2537) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:2528) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1396) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:369) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:179) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseLocalElements(XSDHandler.java:2049) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:582) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:552) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:519) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:485) at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:210) at com.sun.tools.xjc.reader.internalizer.DOMForest.weakSchemaCorrectnessCheck(DOMForest.java:487) at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:222) at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:85) at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:134) at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2244) at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:187) at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:144) at com.genuitec.eclipse.ws.jaxws.JAXWSJob$MEWSDLModeler.buildModel(JAXWSJob.java:522) at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:199) at com.genuitec.eclipse.ws.jaxws.JAXWSJob.wsImport(JAXWSJob.java:237) at com.genuitec.eclipse.ws.jaxws.JAXWSJob.run(JAXWSJob.java:138) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
This was NOT detected in the WSDL validation! I did not abort the operation and allowed ME to continue with the client creation operation.
Any suggestions would be greatly appreciated.
Thanks for taking the time to read my post……
Russ
RussMemberOkay I figured it out……
What I did was change the WSDL location from the file defintion (created by ME) to the server definition. ME had generated the client code correctly. Once I changed the definition back. It all worked. However, I am left pondering the SAX Parser error and my WSDL validation…
-
AuthorPosts