Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4877

CXF will throw javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Can't find prefix if the SEI has Action annotation

    XMLWordPrintableJSON

Details

    • Novice

    Description

      There are two key conditions to reproduce this problem:
      1. The targetNamesapce of SEI and impl class is different;
      2. Add @Action annotation in SEI.

      SEI:

      @WebService(name = "SimonTestOne", targetNamespace = "iftest.interfaces.webservice_g2.annotations")
      @XmlSeeAlso({
          ObjectFactory.class
      })
      public interface SimonTestOne {
          /**
           * 
           * @param arg0
           * @return
           *     returns java.lang.String
           */
          @WebMethod
          @WebResult(name = "notreturn", targetNamespace = "")
          @RequestWrapper(localName = "bareIfMethod", targetNamespace = "iftest.interfaces.webservice_g2.annotations", className = "annotations.webservice_g2.interfaces.iftest.BareIfMethod")
          @ResponseWrapper(localName = "bareIfMethodResponse", targetNamespace = "iftest.interfaces.webservice_g2.annotations", className = "annotations.webservice_g2.interfaces.iftest.BareIfMethodResponse")
          @Action(input = "iftest.interfaces.webservice_g2.annotations/InterfaceTestOne/bareIfMethodRequest", output = "iftest.interfaces.webservice_g2.annotations/InterfaceTestOne/bareIfMethodResponse")
          public String bareIfMethod(
              @WebParam(name = "arg0", targetNamespace = "")
              String arg0);
      }
      

      Impl class

      @WebService(targetNamespace="server.interfaces.webservice_g2.annotations",
      			serviceName="ifimplsvc",
      			portName="iftest",
      			endpointInterface="annotations.webservice_g2.interfaces.server.SimonTestOne"
                  )
      		
      public class SimonTestOneImpl{
      	// implemented from interface
      	public String bareIfMethod(String s){return  s;}
      }
      

      command:

      java2ws -cp . -verbose -client -server -wsdl -d "D:\temp\wsgencxf" -s "D:\temp\wsgencxf" 
      

      The exception statck is:

      javax.wsdl.WSDLException: WSDLException: faultCode=OTHER_ERROR: Can't find prefix for 'http://www.w3.org/2007/05/addressing/metadata'. Namespace prefixes must be set on the Definition object using the addNamespace(...) method.
      	at com.ibm.wsdl.util.xml.DOMUtils.getPrefix(Unknown Source)
      	at com.ibm.wsdl.util.xml.DOMUtils.getQualifiedValue(Unknown Source)
      	at com.ibm.wsdl.util.xml.DOMUtils.printQualifiedAttribute(Unknown Source)
      	at com.ibm.wsdl.xml.WSDLWriterImpl.printExtensibilityAttributes(Unknown Source)
      	at com.ibm.wsdl.xml.WSDLWriterImpl.printInput(Unknown Source)
      	at com.ibm.wsdl.xml.WSDLWriterImpl.printOperations(Unknown Source)
      	at com.ibm.wsdl.xml.WSDLWriterImpl.printPortTypes(Unknown Source)
      	at com.ibm.wsdl.xml.WSDLWriterImpl.printDefinition(Unknown Source)
      	at com.ibm.wsdl.xml.WSDLWriterImpl.writeWSDL(Unknown Source)
      	at com.ibm.wsdl.xml.WSDLWriterImpl.writeWSDL(Unknown Source)
      	at org.apache.cxf.tools.java2wsdl.generator.wsdl11.WSDL11Generator.generate(WSDL11Generator.java:99)
      	at org.apache.cxf.tools.java2wsdl.generator.wsdl11.WSDL11Generator.generate(WSDL11Generator.java:1)
      	at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.generate(JavaToWSDLProcessor.java:156)
      	at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.process(JavaToWSDLProcessor.java:118)
      	at org.apache.cxf.tools.java2ws.JavaToWSContainer.processWSDL(JavaToWSContainer.java:110)
      	at org.apache.cxf.tools.java2ws.JavaToWSContainer.execute(JavaToWSContainer.java:75)
      	at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
      	at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:58)
      	at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:40)
      	at org.apache.cxf.tools.java2ws.JavaToWS.run(JavaToWS.java:77)
      	at org.apache.cxf.tools.java2ws.JavaToWS.main(JavaToWS.java:45)
      

      Attachments

        1. CXF-4877.patch
          4 kB
          Yan Min Sheng

        Activity

          People

            dkulp Daniel Kulp
            shengym Yan Min Sheng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: