Java 使用<;wsdl:import>;通过SSL重定向

Java 使用<;wsdl:import>;通过SSL重定向,java,web-services,redirect,ssl,cxf,Java,Web Services,Redirect,Ssl,Cxf,我已经使用CXF部署了一个契约优先的web服务 部署到其中的服务器执行从http到ssl的302重定向,因此对*的任何请求都会返回http 302错误代码并重定向到* 在原始WSDL中,在另一个命名空间中有对XSD元素的引用,因此生成的WSDL(提供的WSDL)包含一个元素 如果我试图通过在字符串中手动构建SOAP请求并通过SSL套接字发送来调用WS,WS将正确响应。我的密钥库中有所有必要的证书 但是,当我尝试使用CXF的wsdl2java指向https://server/app/service

我已经使用CXF部署了一个契约优先的web服务

部署到其中的服务器执行从http到ssl的302重定向,因此对*的任何请求都会返回http 302错误代码并重定向到*

在原始WSDL中,在另一个命名空间中有对XSD元素的引用,因此生成的WSDL(提供的WSDL)包含一个
元素

如果我试图通过在字符串中手动构建SOAP请求并通过SSL套接字发送来调用WS,WS将正确响应。我的密钥库中有所有必要的证书

但是,当我尝试使用CXF的wsdl2java指向
https://server/app/services/MyService?wsdl
,我得到以下错误(下面是完整的堆栈跟踪):

跟踪引用的是
语句。其
位置
属性为
http://server:80/app/services/MyService?wsdl=MyServicePortType.wsdl
。我的猜测是由于302重定向而引发错误。它应该是
https://server/app/services/MyService?wsdl=MyServicePortType.wsdl

原始WSDL是URL不可知的,服务的URL是在Spring
元素中相对定义的。它是通过cxfservlet访问的。也就是说,原始WSDL的
中没有
元素


原来服务实现
mypackage.MyServiceImpl
缺少注释

一旦包含适当的
serviceName
portName
targetNamespace
endpointInterface
属性,则部署的服务将不包含
。我怀疑这主要与
targetNamespace
属性有关

然而,外部XSD仍然会被http地址引用,比如
。我在原始WSDL中引用了它们。对我来说,唯一的解决方案是将所有XSD定义内联到原始WSDL中

[Fatal Error] MyService?wsdl=MyServicePortType.wsdl:1:50: 
    White spaces are required between publicId and systemId.
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<bean id="myServiceBean" class="mypackage.MyServiceImpl" />
<jaxws:endpoint 
    id="myServiceEndpoint" 
    implementor="#myServiceBean" 
    address="/MyService">
</jaxws:endpoint>
D:\>wsdl2java -d src -client -impl -verbose -db xmlbeans -autoNameResolution -validate -compile -classdir classes https://server/app/services/MyService?wsdl
Loading FrontEnd jaxws ...
Loading DataBinding xmlbeans ...
wsdl2java -d src -client -impl -verbose -db xmlbeans -autoNameResolution -valida
te -compile -classdir classes https://server/app/services/MyService?wsdl
wsdl2java - Apache CXF 2.3.2

[Fatal Error] MyService?wsdl=MyServicePortType.wsdl:1:50: White spaces are required between publicId and systemId.

WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : https://server/app/services/MyService?wsdl
Caused by : WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing 'http://server:80/app/services/MyService?wsdl=MyServicePortType.wsdl'.: org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.

org.apache.cxf.tools.common.ToolException: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : https://server/app/services/MyService?wsdl
Caused by : WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing 'http://server:80/app/services/MyService?wsdl=MyServicePortType.wsdl'.: org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:288)
        at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:113)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:86)
        at org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:184)
Caused by: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsdl definition from : https://server/app/services/MyService?wsdl
Caused by : WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing 'http://server:80/app/services/MyService?wsdl=MyServicePortType.wsdl'.: org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.
        at org.apache.cxf.wsdl11.WSDLDefinitionBuilder.parseWSDL(WSDLDefinitionBuilder.java:97)
        at org.apache.cxf.wsdl11.WSDLDefinitionBuilder.build(WSDLDefinitionBuilder.java:69)
        at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.build(JAXWSDefinitionBuilder.java:84)
        at org.apache.cxf.tools.wsdlto.frontend.jaxws.wsdl11.JAXWSDefinitionBuilder.build(JAXWSDefinitionBuilder.java:61)
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.java:170)
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:137)
        at org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:280)
        ... 4 more
Caused by: javax.wsdl.WSDLException: WSDLException (at /wsdl:definitions/wsdl:import): faultCode=PARSER_ERROR: Problem parsing 'http://server:80/app/services/MyService?wsdl=MyServicePortType.wsdl'.: org.xml.sax.SAXParseException: White spaces are required between publicId and systemId.
        at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.parseImport(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
        at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:237)
        at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:186)
        at org.apache.cxf.wsdl11.WSDLDefinitionBuilder.parseWSDL(WSDLDefinitionBuilder.java:78)
        ... 10 more
Caused by: org.xml.sax.SAXParseExceptionpublicId: http://server:80/app/services/MyService?wsdl=MyServicePortType.wsdl; systemId: http://server:80/app/services/MyService?wsdl=MyServicePortType.wsdl; lineNumber: 1; columnNumber: 50; White spaces are required between publicId and systemId.
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        ... 18 more