SOAPFaultException when deployed to Tomcat but works fine in GlassFish

Friends, I tried a lot and read a lot of forums but couldn't figure out why this problem fits.
I created a Jax-WS WebService using the first contract approach. Created the WSDL and XSD and then used the wsimport tool to generate the rest of the artifacts, provided the implementation for SEI.

Deployed WebService for GlassFish in Eclipse Helios (Glassfish adapter and plugin installed in Eclipse). Tested the deployed service via SoapUI and it works fine.

I have deployed this web service to Tomcat7.0 as a WAR file. Structure like:

-> WEB-INF -> classes -> ...
-> wsdl -> .wsdl and .xsd
-> web.xml
-> sun-jaxws.xml

When I test a web service through SoapUI, the response I get is an exception:

<S:Envelope xmlns:S="">
      <S:Fault xmlns:ns3="">
        <faultstring>unexpected XML tag. expected: {http://localhost/fundmanagertd}addFund but found: {http://localhost/fundmanagertd}requestAddFund</faultstring>


I think it works in Glassfish because Glassfish generates all artifacts on the fly and doesn't accept those that are already created. Although Tomcat only accepts those in the deployed package. Why I think so is because web services only run in Glassfish when sun-jaxws.xml is not provided, but when it is provided I cannot see the service under Deployed Service. Although Tomcat uses sun-jasws.xml and uses the classes I provided and fails. I don't know why this is happening. Any direction from here would be much appreciated.

WSDL I am using:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions targetNamespace="http://localhost/fundmanagertd" name="FundManagerTDService" xmlns="" xmlns:tns="http://localhost/fundmanagertd" xmlns:xsd="" xmlns:soap="">
      <xsd:import namespace="http://localhost/fundmanagertd" schemaLocation="FundManagerTDService_schema1.xsd"/>
  <message name="addFund">
    <part name="parameters" element="tns:requestAddFund"/>
  <message name="addFundResponse">
    <part name="parameters" element="tns:responseAddFund"/>
  <portType name="Fund">
    <operation name="addFund">
      <input message="tns:addFund"/>
      <output message="tns:addFundResponse"/>
  <binding name="FundPortBinding" type="tns:Fund">
    <soap:binding transport="" style="document"/>
    <operation name="addFund">
      <soap:operation soapAction="urn:Add"/>
        <soap:body use="literal"/>
        <soap:body use="literal"/>
  <service name="FundManagerTDService">
    <port name="FundPort" binding="tns:FundPortBinding">
      <soap:address location="REPLACE_WITH_ACTUAL_URL"/>



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema version="1.0" targetNamespace="http://localhost/fundmanagertd" xmlns:tns="http://localhost/fundmanagertd" xmlns:xs="">

  <xs:element name="requestAddFund" type="tns:requestAddFund"/>

  <xs:element name="responseAddFund" type="tns:responseAddFund"/>

  <xs:complexType name="fund">
      <xs:element name="annuity" type="tns:annuityType" minOccurs="0"/>
      <xs:element name="duration" type="xs:int"/>
      <xs:element name="endDate" type="xs:dateTime" minOccurs="0"/>
      <xs:element name="id" type="xs:long"/>
      <xs:element name="name" type="xs:string" minOccurs="0"/>
      <xs:element name="premium" type="xs:float"/>
      <xs:element name="startDate" type="xs:dateTime" minOccurs="0"/>
      <xs:element name="type" type="tns:investmentType" minOccurs="0"/>
      <xs:element name="value" type="xs:float"/>

  <xs:complexType name="requestAddFund">
      <xs:element name="arg0" type="tns:fund" minOccurs="0"/>
      <xs:element name="arg1" type="xs:string" minOccurs="0"/>

  <xs:complexType name="responseAddFund">
      <xs:element name="return" type="xs:long"/>

  <xs:simpleType name="annuityType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="MONTHLY"/>

  <xs:simpleType name="investmentType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="MF"/>


SoapUI generates a request automatically and it:

<soapenv:Envelope xmlns:soapenv="" xmlns:fun="http://localhost/fundmanagertd">


Also, I tried to create a static client to access my web service and I get a SOAPFaultException with "Unexpected XML tag message ..."

Also, adding sun-jaxws.xml for reference:

<?xml version="1.0" encoding="UTF-8"?>




source to share

1 answer

I think the first element in the SOAP Body request should be the operations you are calling. This means that the automatically generated XML needs to be modified. This is exactly what the error says:

... expected:

... addFund - method name - but found:

... requestAddFund is the name of the data type



All Articles