You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by imiten <im...@yahoo.com> on 2012/04/21 16:17:49 UTC

com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 404: Not Found

Hi,

I managed to get webapp running on tomcat.  I had to copy wsdl to classes
and also keep one above WEB-INF. Here is error when I run client:

Invoking server through Dispatch interface using SOAPMessage
Exception in thread "main"
com.sun.xml.internal.ws.client.ClientTransportException:* The server sent
HTTP status code 404: Not Found*
	at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:296)
	at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:245)
	at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:203)
	at
com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122)
	at
com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)
	at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626)
	at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585)
	at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)
	at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)
	at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308)
	at
com.sun.xml.internal.ws.client.dispatch.DispatchImpl.doInvoke(DispatchImpl.java:177)
	at
com.sun.xml.internal.ws.client.dispatch.DispatchImpl.invoke(DispatchImpl.java:203)
	at
com.mkyong.webservice.ProductWebService_PortTypeClient.main(ProductWebService_PortTypeClient.java:43)

Here is wsdl:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="ProductWebServiceService"
targetNamespace="http://webservice.mkyong.com/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://webservice.mkyong.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://webservice.mkyong.com/" attributeFormDefault="unqualified"
elementFormDefault="unqualified"
targetNamespace="http://webservice.mkyong.com/">
  <xs:complexType abstract="true" name="soapMessage">
    <xs:sequence>
      <xs:element minOccurs="0" name="contentDescription" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="invoke" nillable="true" type="xs:anyType"/>
  <xs:element name="invokeResponse" nillable="true" type="xs:anyType"/>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="invoke">
    <wsdl:part name="invoke" element="tns:invoke">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="invokeResponse">
    <wsdl:part name="invokeResponse" element="tns:invokeResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="ProductWebService">
    <wsdl:operation name="invoke">
      <wsdl:input name="invoke" message="tns:invoke">
    </wsdl:input>
      <wsdl:output name="invokeResponse" message="tns:invokeResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="ProductWebServiceServiceSoapBinding"
type="tns:ProductWebService">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="invoke">
      <soap:operation soapAction="" style="document"/>
      <wsdl:input name="invoke">
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="invokeResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="ProductWebServiceService">
    <wsdl:port name="ProductWebServicePort"
binding="tns:ProductWebServiceServiceSoapBinding">
      <soap:address location="http://localhost:8080/ProductWebServicePort"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Client:

/**
 * Please modify this class to meet your needs
 * This class is not complete
 */

package com.mkyong.webservice;
import java.io.InputStream;
import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPMessage;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;

/**
 * This class was generated by Apache CXF 2.5.2
 * 2012-04-13T13:43:44.952+05:30
 * Generated source version: 2.5.2
 * 
 */
public class ProductWebService_PortTypeClient {

    public static void main(String[] args) throws Exception {
        QName serviceName = new QName("http://webservice.mkyong.com/",
"ProductWebServiceService");
        QName portName = new QName("http://webservice.mkyong.com/",
"ProductWebServicePort");

        Service service = Service.create(new
URL("http://localhost:8080/mkyong_webapp/wsdl/ProductWebService.wsdl"),
serviceName);
        Dispatch<SOAPMessage> dispatch = service.createDispatch(portName,
SOAPMessage.class, Service.Mode.MESSAGE);
        
        InputStream is1 = 
ProductWebService_PortTypeClient.class.getResourceAsStream("CreateProduct.xml");
        if (is1 == null) {
            System.err.println("Failed to create input stream from file "
                               + "CreateProduct.xml, please check");
            System.exit(-1);
        }
        MessageFactory factory = MessageFactory.newInstance();
        SOAPMessage soapReq1 = factory.createMessage(null, is1);
        

        System.out.println("Invoking server through Dispatch interface using
SOAPMessage");
        SOAPMessage soapResp = dispatch.invoke(soapReq1);
        System.out.println("Response from server: " +
soapResp.getSOAPBody().getTextContent());

        

    }

}



--
View this message in context: http://cxf.547215.n5.nabble.com/com-sun-xml-internal-ws-client-ClientTransportException-The-server-sent-HTTP-status-code-404-Not-Foud-tp5656294p5656294.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 404: Not Found

Posted by Glen Mazza <gm...@talend.com>.
My WSDL-first tutorial might point out anything different you're doing 
on your side causing the error:
http://www.jroller.com/gmazza/entry/web_service_tutorial

HTH,
Glen

On 04/21/2012 10:17 AM, imiten wrote:
> Hi,
>
> I managed to get webapp running on tomcat.  I had to copy wsdl to classes
> and also keep one above WEB-INF. Here is error when I run client:
>
> Invoking server through Dispatch interface using SOAPMessage
> Exception in thread "main"
> com.sun.xml.internal.ws.client.ClientTransportException:* The server sent
> HTTP status code 404: Not Found*
> 	at
> com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatusCode(HttpTransportPipe.java:296)
> 	at
> com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResponsePacket(HttpTransportPipe.java:245)
> 	at
> com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:203)
> 	at
> com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:122)
> 	at
> com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:95)
> 	at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626)
> 	at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585)
> 	at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570)
> 	at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467)
> 	at com.sun.xml.internal.ws.client.Stub.process(Stub.java:308)
> 	at
> com.sun.xml.internal.ws.client.dispatch.DispatchImpl.doInvoke(DispatchImpl.java:177)
> 	at
> com.sun.xml.internal.ws.client.dispatch.DispatchImpl.invoke(DispatchImpl.java:203)
> 	at
> com.mkyong.webservice.ProductWebService_PortTypeClient.main(ProductWebService_PortTypeClient.java:43)
>
> Here is wsdl:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions name="ProductWebServiceService"
> targetNamespace="http://webservice.mkyong.com/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:tns="http://webservice.mkyong.com/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
>    <wsdl:types>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://webservice.mkyong.com/" attributeFormDefault="unqualified"
> elementFormDefault="unqualified"
> targetNamespace="http://webservice.mkyong.com/">
>    <xs:complexType abstract="true" name="soapMessage">
>      <xs:sequence>
>        <xs:element minOccurs="0" name="contentDescription" type="xs:string"/>
>      </xs:sequence>
>    </xs:complexType>
>    <xs:element name="invoke" nillable="true" type="xs:anyType"/>
>    <xs:element name="invokeResponse" nillable="true" type="xs:anyType"/>
> </xs:schema>
>    </wsdl:types>
>    <wsdl:message name="invoke">
>      <wsdl:part name="invoke" element="tns:invoke">
>      </wsdl:part>
>    </wsdl:message>
>    <wsdl:message name="invokeResponse">
>      <wsdl:part name="invokeResponse" element="tns:invokeResponse">
>      </wsdl:part>
>    </wsdl:message>
>    <wsdl:portType name="ProductWebService">
>      <wsdl:operation name="invoke">
>        <wsdl:input name="invoke" message="tns:invoke">
>      </wsdl:input>
>        <wsdl:output name="invokeResponse" message="tns:invokeResponse">
>      </wsdl:output>
>      </wsdl:operation>
>    </wsdl:portType>
>    <wsdl:binding name="ProductWebServiceServiceSoapBinding"
> type="tns:ProductWebService">
>      <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>      <wsdl:operation name="invoke">
>        <soap:operation soapAction="" style="document"/>
>        <wsdl:input name="invoke">
>          <soap:body use="literal"/>
>        </wsdl:input>
>        <wsdl:output name="invokeResponse">
>          <soap:body use="literal"/>
>        </wsdl:output>
>      </wsdl:operation>
>    </wsdl:binding>
>    <wsdl:service name="ProductWebServiceService">
>      <wsdl:port name="ProductWebServicePort"
> binding="tns:ProductWebServiceServiceSoapBinding">
>        <soap:address location="http://localhost:8080/ProductWebServicePort"/>
>      </wsdl:port>
>    </wsdl:service>
> </wsdl:definitions>
>
> Client:
>
> /**
>   * Please modify this class to meet your needs
>   * This class is not complete
>   */
>
> package com.mkyong.webservice;
> import java.io.InputStream;
> import java.net.URL;
>
> import javax.xml.namespace.QName;
> import javax.xml.soap.MessageFactory;
> import javax.xml.soap.SOAPMessage;
> import javax.xml.ws.Dispatch;
> import javax.xml.ws.Service;
>
> /**
>   * This class was generated by Apache CXF 2.5.2
>   * 2012-04-13T13:43:44.952+05:30
>   * Generated source version: 2.5.2
>   *
>   */
> public class ProductWebService_PortTypeClient {
>
>      public static void main(String[] args) throws Exception {
>          QName serviceName = new QName("http://webservice.mkyong.com/",
> "ProductWebServiceService");
>          QName portName = new QName("http://webservice.mkyong.com/",
> "ProductWebServicePort");
>
>          Service service = Service.create(new
> URL("http://localhost:8080/mkyong_webapp/wsdl/ProductWebService.wsdl"),
> serviceName);
>          Dispatch<SOAPMessage>  dispatch = service.createDispatch(portName,
> SOAPMessage.class, Service.Mode.MESSAGE);
>
>          InputStream is1 =
> ProductWebService_PortTypeClient.class.getResourceAsStream("CreateProduct.xml");
>          if (is1 == null) {
>              System.err.println("Failed to create input stream from file "
>                                 + "CreateProduct.xml, please check");
>              System.exit(-1);
>          }
>          MessageFactory factory = MessageFactory.newInstance();
>          SOAPMessage soapReq1 = factory.createMessage(null, is1);
>
>
>          System.out.println("Invoking server through Dispatch interface using
> SOAPMessage");
>          SOAPMessage soapResp = dispatch.invoke(soapReq1);
>          System.out.println("Response from server: " +
> soapResp.getSOAPBody().getTextContent());
>
>
>
>      }
>
> }
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/com-sun-xml-internal-ws-client-ClientTransportException-The-server-sent-HTTP-status-code-404-Not-Foud-tp5656294p5656294.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza


Re: com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 404: Not Found

Posted by Daniel Kulp <dk...@apache.org>.
2 things:

1) You aren't using CXF on the client.  This is the JAX-WS impl built into 
the JDK, not CXF.  Make sure the CXF jars are being picked up if you intend 
to fully use CXF.

2) The error is a 404.   Make sure the endpoint is actually running on the 
URL that is in the soap:address of the wsdl.


Dan



On Saturday, April 21, 2012 07:17:49 AM imiten wrote:
> Hi,
> 
> I managed to get webapp running on tomcat.  I had to copy wsdl to classes
> and also keep one above WEB-INF. Here is error when I run client:
> 
> Invoking server through Dispatch interface using SOAPMessage
> Exception in thread "main"
> com.sun.xml.internal.ws.client.ClientTransportException:* The server sent
> HTTP status code 404: Not Found*
> 	at
> com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.checkStatu
> sCode(HttpTransportPipe.java:296) at
> com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.createResp
> onsePacket(HttpTransportPipe.java:245) at
> com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Ht
> tpTransportPipe.java:203) at
> com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processReq
> uest(HttpTransportPipe.java:122) at
> com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(Def
> erredTransportPipe.java:95) at
> com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:626) at
> com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:585) at
> com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:570) at
> com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:467) at
> com.sun.xml.internal.ws.client.Stub.process(Stub.java:308)
> 	at
> com.sun.xml.internal.ws.client.dispatch.DispatchImpl.doInvoke(DispatchImpl
> .java:177) at
> com.sun.xml.internal.ws.client.dispatch.DispatchImpl.invoke(DispatchImpl.j
> ava:203) at
> com.mkyong.webservice.ProductWebService_PortTypeClient.main(ProductWebServ
> ice_PortTypeClient.java:43)
> 
> Here is wsdl:
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions name="ProductWebServiceService"
> targetNamespace="http://webservice.mkyong.com/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:tns="http://webservice.mkyong.com/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
>   <wsdl:types>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns="http://webservice.mkyong.com/" attributeFormDefault="unqualified"
> elementFormDefault="unqualified"
> targetNamespace="http://webservice.mkyong.com/">
>   <xs:complexType abstract="true" name="soapMessage">
>     <xs:sequence>
>       <xs:element minOccurs="0" name="contentDescription"
> type="xs:string"/> </xs:sequence>
>   </xs:complexType>
>   <xs:element name="invoke" nillable="true" type="xs:anyType"/>
>   <xs:element name="invokeResponse" nillable="true" type="xs:anyType"/>
> </xs:schema>
>   </wsdl:types>
>   <wsdl:message name="invoke">
>     <wsdl:part name="invoke" element="tns:invoke">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:message name="invokeResponse">
>     <wsdl:part name="invokeResponse" element="tns:invokeResponse">
>     </wsdl:part>
>   </wsdl:message>
>   <wsdl:portType name="ProductWebService">
>     <wsdl:operation name="invoke">
>       <wsdl:input name="invoke" message="tns:invoke">
>     </wsdl:input>
>       <wsdl:output name="invokeResponse" message="tns:invokeResponse">
>     </wsdl:output>
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="ProductWebServiceServiceSoapBinding"
> type="tns:ProductWebService">
>     <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
>     <wsdl:operation name="invoke">
>       <soap:operation soapAction="" style="document"/>
>       <wsdl:input name="invoke">
>         <soap:body use="literal"/>
>       </wsdl:input>
>       <wsdl:output name="invokeResponse">
>         <soap:body use="literal"/>
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="ProductWebServiceService">
>     <wsdl:port name="ProductWebServicePort"
> binding="tns:ProductWebServiceServiceSoapBinding">
>       <soap:address
> location="http://localhost:8080/ProductWebServicePort"/> </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
> 
> Client:
> 
> /**
>  * Please modify this class to meet your needs
>  * This class is not complete
>  */
> 
> package com.mkyong.webservice;
> import java.io.InputStream;
> import java.net.URL;
> 
> import javax.xml.namespace.QName;
> import javax.xml.soap.MessageFactory;
> import javax.xml.soap.SOAPMessage;
> import javax.xml.ws.Dispatch;
> import javax.xml.ws.Service;
> 
> /**
>  * This class was generated by Apache CXF 2.5.2
>  * 2012-04-13T13:43:44.952+05:30
>  * Generated source version: 2.5.2
>  *
>  */
> public class ProductWebService_PortTypeClient {
> 
>     public static void main(String[] args) throws Exception {
>         QName serviceName = new QName("http://webservice.mkyong.com/",
> "ProductWebServiceService");
>         QName portName = new QName("http://webservice.mkyong.com/",
> "ProductWebServicePort");
> 
>         Service service = Service.create(new
> URL("http://localhost:8080/mkyong_webapp/wsdl/ProductWebService.wsdl"),
> serviceName);
>         Dispatch<SOAPMessage> dispatch = service.createDispatch(portName,
> SOAPMessage.class, Service.Mode.MESSAGE);
> 
>         InputStream is1 =
> ProductWebService_PortTypeClient.class.getResourceAsStream("CreateProduct.
> xml"); if (is1 == null) {
>             System.err.println("Failed to create input stream from file "
>                                + "CreateProduct.xml, please check");
>             System.exit(-1);
>         }
>         MessageFactory factory = MessageFactory.newInstance();
>         SOAPMessage soapReq1 = factory.createMessage(null, is1);
> 
> 
>         System.out.println("Invoking server through Dispatch interface
> using SOAPMessage");
>         SOAPMessage soapResp = dispatch.invoke(soapReq1);
>         System.out.println("Response from server: " +
> soapResp.getSOAPBody().getTextContent());
> 
> 
> 
>     }
> 
> }
> 
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/com-sun-xml-internal-ws-client-ClientTran
> sportException-The-server-sent-HTTP-status-code-404-Not-Foud-tp5656294p565
> 6294.html Sent from the cxf-user mailing list archive at Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com