Hi Xavier,
Yes. I meant for the wsdl's imports. But I don't know how your wsdl is
built or generated. If it is automatically generated, you probably
can't change that import's location.

Maybe, there might be a property you can configure to follow the
redirection, but I don't know. Maybe, someone else can help.

regards, aki

2012/3/7 Xavier López <[email protected]>:
> Thanks for your response, Aki. I don't know the way, if there's any.
> I'd appreciate any tip on this matter.
>
> Is this actually a defect in the XML parser, unable to follow the redirect ?
>
> I forgot specifying my service's URL is defined relative to the app,
> in a Spring <jaxws:endpoint>, like this:
>
> <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>
>
> Maybe I should investigate how is that
> "http://server:80/app/services/MyService?wsdl=MyServicePortType.wsdl";
> address made up.
>
> I'll also post a complete stack trace, just in case.
>
> 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
>
> 2012/3/7 Aki Yoshida <[email protected]>
>>
>> Is there any possibility to define your import location url relative
>> to the original location? If that works out, that might probably solve
>> the problem.
>>
>> 2012/3/7 Xavier López <[email protected]>:
>> > Hi. I've deployed a contract-first web service using CXF.
>> >
>> > The server into which it is deployed performs 302 redirections from http to
>> > ssl, so any request to http://server/app/* returns an HTTP 302 error code
>> > and redirects to https://server/app/*.
>> >
>> > In the original WSDL there are references to XSD elements in another
>> > namespace, so the generated WSDL (the one
>> > http://server/app/services/MyService?wsdl provides) contains a
>> > `<wsdl:import>` element.
>> >
>> > If I try to invoke the WS by manually building a SOAP request in a String
>> > and send it over an SSL socket, the WS responds correctly. I've got all
>> > necessary certificates in my keystore.
>> >
>> > However, when I try to build a client using CXF's wsdl2java pointing to `
>> > https://server/app/services/MyService?wsdl`, I get the following error:
>> >
>> >    [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.
>> >
>> > The trace is referring to the `<wsdl:import>` statement. Its `location`
>> > attribute is `
>> > http://server:80/app/services/MyService?wsdl=MyServicePortType.wsdl`. My
>> > guess is that the error is thrown because of the 302 redirection.
>> >
>> > The original WSDL is URL-agnostic, and the service's URL is defined
>> > relative. It is accessed through the CXF servlet.
>> >
>> > Should I specify somewhere in the service's autogenerated classes or wsdl
>> > that the service is to be deployed on SSL? And how could I do it?

Reply via email to