[
https://issues.apache.org/jira/browse/CXF-4877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yan Min Sheng updated CXF-4877:
-------------------------------
Attachment: CXF-4877.patch
I created a patch to fix it.
Basically I add code to add the prefix plus namespace into the imported SEI
definition from the current service implementation definition as follows:
//add the nameSpace of implementation service definition to the
imported SEI definition
Iterator<Map.Entry<String, String>> iterator =
CastUtils.cast(def.getNamespaces().entrySet().iterator());
while (iterator.hasNext()) {
Map.Entry<String, String> entry = iterator.next();
imp.getDefinition().addNamespace(entry.getKey(),
entry.getValue());
}
> CXF will throw javax.wsdl.WSDLException: WSDLException:
> faultCode=OTHER_ERROR: Can't find prefix if the SEI has Action annotation
> ---------------------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-4877
> URL: https://issues.apache.org/jira/browse/CXF-4877
> Project: CXF
> Issue Type: Bug
> Components: Core, Tooling
> Affects Versions: 2.6.2
> Environment: 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)
> Reporter: Yan Min Sheng
> Attachments: CXF-4877.patch
>
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira