0

I have a WSDL and some schema files that I used to generate a JAX-WS web service client. When I try to get an instance of the client, I get this stack trace:

Caused by: java.lang.IllegalArgumentException: The specified prefix was null.
    at com.ibm.xml.xlxp.api.stax.msg.StAXMessageProvider.throwIllegalArgumentException(StAXMessageProvider.java:42)
    at com.ibm.xml.xlxp.api.stax.XMLStreamReaderImpl.getNamespaceURI(XMLStreamReaderImpl.java:721)
    at com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl$XMLStreamReaderProxy.getNamespaceURI(XMLInputFactoryImpl.java:212)
    at com.sun.xml.internal.ws.util.xml.XMLStreamReaderFilter.getNamespaceURI(XMLStreamReaderFilter.java:242)
    at com.sun.xml.internal.ws.wsdl.parser.ParserUtil.getQName(ParserUtil.java:78)
    at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parsePortTypeOperationInput(RuntimeWSDLParser.java:721)
    at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parsePortTypeOperation(RuntimeWSDLParser.java:694)
    at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parsePortType(RuntimeWSDLParser.java:668)
    at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parseWSDL(RuntimeWSDLParser.java:305)
    at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:136)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:227)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.(WSServiceDelegate.java:190)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.(WSServiceDelegate.java:160)
    at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:92)
    at javax.xml.ws.Service.(Service.java:67)
...

It looks a lot to me like the Service class is trying to parse the WSDL as a part of its initialization, and then fails because some prefix is null. The line at com.sun.xml.internal.ws.wsdl.parser.ParserUtil.getQName(ParserUtil.java:78) suggests it's having trouble parsing the QName. When the service is created, the QName is set like this:

new QName("http://www.mycompany.ca/some/schema/MyService", "MyService")

The error message is not too clear though. Is a prefix needed before "MyService" or are changes to the WSDL necessary (I am not the WSDL owner so changes are difficult to push to other teams).

(environment is RAD 7.5 for WAS 7.0)

FrustratedWithFormsDesigner
  • 26,726
  • 31
  • 139
  • 202

1 Answers1

1

If you examine the details of the stack trace, you'll notice that the problem is with the name of a port type operation input in the WSDL:

<wsdl:definitions .... > 
  <wsdl:portType .... >
    <wsdl:operation>
       <wsdl:input message="qname"/>    <--- your problem is here
    </wsdl:operation>
  </wsdl:portType >
</wsdl:definitions>
Marko Topolnik
  • 195,646
  • 29
  • 319
  • 436
  • You're right, it makes sense that this is a port type problem. All of the operations are of the format: ` `, none of them have prefixes. But, I didn't think prefixes were necessary in this case. – FrustratedWithFormsDesigner Aug 16 '12 at 19:25
  • They wouldn't be necessary only if the default namespace in effect was correct. – Marko Topolnik Aug 16 '12 at 19:29
  • Interesting. I added a namespace prefix for the default namespace then added the prefix so that the input now looks like: ``. Regenerated the client. Exact same error... – FrustratedWithFormsDesigner Aug 16 '12 at 19:58
  • But this is happening at runtime, right? The WSDL that is being read is not the one you used to generate the client, but the one available at the public URL. – Marko Topolnik Aug 16 '12 at 20:08
  • Note that all this may be a bug with the IBM implementation, which may be working under the false assumption that everything will use a namespace prefix. – Marko Topolnik Aug 16 '12 at 20:42
  • I think you might be right about the IBM implementation assuming everything must have a namespace prefix. I am certain I've seen this work before with default namespaces, but I can't guarantee that it was the same environment. – FrustratedWithFormsDesigner Aug 17 '12 at 15:00