Skip to main content

Accessing web service throws XMLStreamReaderException: unexpected XML tag. expected:

1 reply [Last post]
billybacon
Offline
Joined: 2009-02-03
Points: 0

I've hit another roadblock after getting the WSDL and XSD ironed out and fixed (namespace issues, etc). I can successfully deploy my webservice as a war to my local tomcat container. Catalina logs all look good, I see such things as:
INFO: WSSERVLET12: JAX-WS context listener initializing
Feb 29, 2012 5:17:48 PM com.sun.xml.ws.server.MonitorBase createRoot
INFO: Metro monitoring rootname successfully set to: com.sun.metro:pp=/,type=WSEndpoint,name=-InventoryExpGenericService-InventoryExpress
Feb 29, 2012 5:17:49 PM com.sun.xml.ws.server.MonitorBase createRoot
INFO: Metro monitoring rootname successfully set to: com.sun.metro:pp=/,type=WSEndpoint,name=-BookInfoService-BookInfoPort
Feb 29, 2012 5:17:49 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate <init>
INFO: WSSERVLET14: JAX-WS servlet initializing
Feb 29, 2012 5:17:49 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory host-manager
Feb 29, 2012 5:17:49 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager
Feb 29, 2012 5:17:49 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9091"]
Feb 29, 2012 5:17:49 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-9010"]
Feb 29, 2012 5:17:49 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 5074 ms

I attempt to call my webservice using a UI client called soapui and point it to my WSDL running under localhost, for example:
http://localhost:9091/services/InventoryExpGenericService?wsdl
Everything is great, loads up the methods available to call. I then attempt to call one of the methods and I'm getting weird error thrown in my Tomcat logs (as well as the soap response):
com.sun.xml.ws.streaming.XMLStreamReaderException: unexpected XML tag. expected: {http://services.midwesttapes.com/}searchByISBN but found: {http://www.iii.com/InventoryExpress}searchByISBN
at com.sun.xml.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:218)
at com.sun.xml.ws.streaming.XMLStreamReaderUtil.verifyTag(XMLStreamReaderUtil.java:226)
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.readRequest(EndpointArgumentsBuilder.java:553)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:247)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:100)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:641)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:600)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:585)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:482)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:314)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:608)

What makes no sense to me is that the string "services.midwesttapes.com" is absolutely _no where_ to be found in my entire project or resulting war file.
Here is my sun-jaxws.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">

<endpoint
name="InventoryService"
implementation="com.midwesttapes.services.InventoryExpGenericService"
wsdl="WEB-INF/wsdl/inventory.wsdl"
service="{http://www.iii.com/InventoryExpress}InventoryExpGenericService"
port="{http://www.iii.com/InventoryExpress}InventoryExpress"
url-pattern="/services/InventoryExpGenericService"/>

<endpoint
name="BookInfoService"
implementation="com.midwesttapes.services.BookInfoService"
wsdl="WEB-INF/wsdl/bookinfo.wsdl"
service="{GetBookInfoByISBN}BookInfoService"
port="{GetBookInfoByISBN}BookInfoPort"
url-pattern="/services/BookInfoService"/>

</endpoints>

And my WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://www.iii.com/InventoryExpress"
xmlns:impl="http://www.iii.com/InventoryExpress"
xmlns:intf="http://www.iii.com/InventoryExpress"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://www.iii.com/InventoryExpress" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="searchByISBN">
<complexType>
<sequence>
<element name="Username" type="xsd:string"/>
<element name="Password" type="xsd:string"/>
<element name="ISBN" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="searchByISBNResponse">
<complexType>
<sequence>
<element name="searchByISBNReturn" type="impl:SearchResult"/>
</sequence>
</complexType>
</element>
<complexType name="RecordInfo">
<sequence>
<element name="ISBN" type="xsd:string"/>
<element name="Availability" nillable="true" type="xsd:string"/>
<element maxOccurs="unbounded" minOccurs="0" name="Contributor" nillable="true" type="xsd:string"/>
<element name="Media" nillable="true" type="xsd:string"/>
<element name="Price" nillable="true" type="xsd:string"/>
<element name="Publisher" nillable="true" type="xsd:string"/>
<element name="Title" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="SearchResult">
<sequence>
<element name="ErrorMessage" nillable="true" type="xsd:string"/>
<element name="MatchCount" type="xsd:int"/>
<element maxOccurs="unbounded" minOccurs="0" name="RecordInfo" nillable="true" type="impl:RecordInfo"/>
<element name="Version" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<element name="searchByTitle">
<complexType>
<sequence>
<element name="Username" type="xsd:string"/>
<element name="Password" type="xsd:string"/>
<element name="Title" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="searchByTitleResponse">
<complexType>
<sequence>
<element name="searchByTitleReturn" type="impl:SearchResult"/>
</sequence>
</complexType>
</element>
<element name="searchByContributor">
<complexType>
<sequence>
<element name="Username" type="xsd:string"/>
<element name="Password" type="xsd:string"/>
<element name="Contributor" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="searchByContributorResponse">
<complexType>
<sequence>
<element name="searchByContributorReturn" type="impl:SearchResult"/>
</sequence>
</complexType>
</element>
<element name="searchByKeyword">
<complexType>
<sequence>
<element name="Username" type="xsd:string"/>
<element name="Password" type="xsd:string"/>
<element name="Keyword" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="searchByKeywordResponse">
<complexType>
<sequence>
<element name="searchByKeywordReturn" type="impl:SearchResult"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="searchByKeywordResponse">
<wsdl:part element="impl:searchByKeywordResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="searchByContributorRequest">
<wsdl:part element="impl:searchByContributor" name="parameters"/>
</wsdl:message>
<wsdl:message name="searchByTitleRequest">
<wsdl:part element="impl:searchByTitle" name="parameters"/>
</wsdl:message>
<wsdl:message name="searchByISBNResponse">
<wsdl:part element="impl:searchByISBNResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="searchByISBNRequest">
<wsdl:part element="impl:searchByISBN" name="parameters"/>
</wsdl:message>
<wsdl:message name="searchByContributorResponse">
<wsdl:part element="impl:searchByContributorResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="searchByTitleResponse">
<wsdl:part element="impl:searchByTitleResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="searchByKeywordRequest">
<wsdl:part element="impl:searchByKeyword" name="parameters"/>
</wsdl:message>
<wsdl:portType name="InventoryExpGeneric">
<wsdl:operation name="searchByISBN">
<wsdl:input message="impl:searchByISBNRequest" name="searchByISBNRequest"/>
<wsdl:output message="impl:searchByISBNResponse" name="searchByISBNResponse"/>
</wsdl:operation>
<wsdl:operation name="searchByTitle">
<wsdl:input message="impl:searchByTitleRequest" name="searchByTitleRequest"/>
<wsdl:output message="impl:searchByTitleResponse" name="searchByTitleResponse"/>
</wsdl:operation>
<wsdl:operation name="searchByContributor">
<wsdl:input message="impl:searchByContributorRequest" name="searchByContributorRequest"/>
<wsdl:output message="impl:searchByContributorResponse" name="searchByContributorResponse"/>
</wsdl:operation>
<wsdl:operation name="searchByKeyword">
<wsdl:input message="impl:searchByKeywordRequest" name="searchByKeywordRequest"/>
<wsdl:output message="impl:searchByKeywordResponse" name="searchByKeywordResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="InventoryExpressSoapBinding" type="impl:InventoryExpGeneric">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="searchByISBN">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="searchByISBNRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="searchByISBNResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="searchByTitle">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="searchByTitleRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="searchByTitleResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="searchByContributor">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="searchByContributorRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="searchByContributorResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="searchByKeyword">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="searchByKeywordRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="searchByKeywordResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="InventoryExpGenericService">
<wsdl:port binding="impl:InventoryExpressSoapBinding" name="InventoryExpress">
<wsdlsoap:address location="http://@HOSTNAME@/services/InventoryExpress"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
billybacon
Offline
Joined: 2009-02-03
Points: 0

I was able to solve this issue by simplifying the sun-jaxws.xml file which describes the endpoints availabe in this webservice.

Removing the following attribues from each <endpoint> configuration solved my problem:
- wsdl
- service
- port

So from the above example, my endpoints now look like this:

<endpoint
name="InventoryService"
implementation="com.midwesttapes.services.InventoryExpGenericService"
url-pattern="/services/InventoryExpGenericService"/>

<endpoint
name="BookInfoService"
implementation="com.midwesttapes.services.BookInfoService"
url-pattern="/services/BookInfoService"/>