2012-03-07 18 views
1

私はCXFを使用して契約型の最初のWebサービスを導入しました。<wsdl:import>をSSLリダイレクト経由で使用するWebサービスを使用する

httpからsslへ302のリダイレクトを実行するため、http://server/app/ *への任意の要求はHTTP 302エラーコードを返し、https://server/app/ *にリダイレクトします。

元のWSDLには別の名前空間のXSD要素への参照があるため、生成されたWSDL(http://server/app/services/MyService?wsdlが提供する)には<wsdl:import>要素が含まれています。

SOAPリクエストを手動でStringに作成してSSLソケット経由で送信すると、WSが正しく応答します。私はキーストアに必要な証明書をすべて持っています。私はhttps://server/app/services/MyService?wsdlを指してCXFのWSDL2Javaのを使用してクライアントを構築しようとすると、

はしかし、私は次のようなエラー(以下、完全なスタックトレース)を取得:

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

トレースが<wsdl:import>の文を参照しています。そのlocation属性はhttp://server:80/app/services/MyService?wsdl=MyServicePortType.wsdlです。私の推測では、302リダイレクトのためにエラーがスローされます。代わりにhttps://server/app/services/MyService?wsdl=MyServicePortType.wsdlにする必要があります。

元のWSDLはURLに依存せず、サービスのURLはSpring <jaxws:endpoint>要素で相対的に定義されています。 CXFサーブレットを介してアクセスします。つまり、元のWSDLの<wsdl:port>には、<soap:address>という要素はありません。

<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> 

サービスがSSLでデプロイするサービスの自動生成クラス、WSDLまたはSpringの設定のどこかを指定する必要がありますか?そして私はどうすればそれをすることができますか?

EDIT: おそらく関連リンク:markmail上

完全なスタックトレース:

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 

答えて

0

これは、サービスの実装mypackage.MyServiceImpljavax.jws.WebService注釈がありませんでしたが判明しました。

一度適切 serviceNameに含ま

portNametargetNamespace、およびendpointInterface属性、<wsdl:import>なしで展開サービス。私はこれが主にtargetNamespace属性で行わなければならないと考えています。

しかし、外部XSDはまだ<xsd:import schemaLocation="http://server:80/app/schema/myschema.xsd">のようにhttpアドレスで参照されます。元のWSDLで相対的に参照しました。このための唯一の解決策は、元のWSDL内のすべてのXSD定義をインライン展開することでした。

関連する問題