axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kumar, Amit {PBSG}" <amit.kum...@pbsg.com>
Subject RE: HTTP error in Axis client
Date Wed, 25 Jul 2007 21:06:34 GMT
Thanks Jeff..

I don't see any activity on the Server.

The client code is :

import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.message.SOAPBody;
import org.apache.axis.message.SOAPEnvelope;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

import com.sun.org.apache.xml.internal.serialize.OutputFormat;
import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */

public class webserviceCall {
  private static DocumentBuilder db;
   public static void main(String [] args) throws Exception {
	   	 String endpoint = "http://localhost:7989/Processes/ProvideSTAR2Owner/";
          // initialize variables
          Document reqDoc = null;
          DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
          db = dbf.newDocumentBuilder();
          Document reqDoc2 = db.newDocument();
          SOAPEnvelope se = new SOAPEnvelope();
          SOAPBody sb = (SOAPBody) se.getBody();
          @SuppressWarnings("unused")
		  SOAPEnvelope result;

          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          DocumentBuilder builder = factory.newDocumentBuilder();
          DOMImplementation impl = builder.getDOMImplementation();
          Element e = null;
          Element f = null;
          Node n = null;

          reqDoc = impl.createDocument("","inputMessage",reqDoc2.getDoctype());

          Element root=reqDoc.getDocumentElement();
          String[] id = {"ns0:BusinessID","ns0:SourceSystemID","ns0:SourceSystemName","ns0:RequestType"};
          String[] desc = {"STAR2","STAR2","STAR2","OWNER"};
          f = reqDoc.createElement("ns0:Header");
          f.setAttribute("xmlns:ns0","http://www.ABC.com/NorthAmerica/PCNA/STAR2/Request");
          
          for (int i=0;i<id.length;i++) {
            e = reqDoc.createElement(id[i]);
            n = reqDoc.createTextNode(desc[i]);
            e.appendChild(n);
            f.appendChild(e);
          }
          root.appendChild(f);


          OutputFormat format = new OutputFormat (reqDoc);
          XMLSerializer output = new XMLSerializer(System.out,format);
          //XMLSerializer output = new XMLSerializer(new BufferedWriter(new StringWriter()),format);
          output.serialize(reqDoc);

          Service service = new Service();
          Call call = (Call) service.createCall();
          call.setTargetEndpointAddress(new URL(endpoint));
          //call.setPortName(new QName("/Processes/ProvideSTAR2Owner","GetSTAR2Owner"));
          call.setOperationName(new QName("GetSTAR2Owner"));
          //sb.setQName(new QName("http://localhost:7989/Processes/ProvideSTAR2Owner","ProvideSTAR2Owner"));
          sb.addDocument(reqDoc);
          result = call.invoke(se);

   }
}


-------------------

the WSDL is :

<?xml version="1.0" encoding="UTF-8"?>
<!--Created by TIBCO WSDL-->
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.ABC.com/NorthAmerica/PCNA/STAR2OwnerList/GetSTAR2OwnerImpl"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns0="http://www.ABC.com/NorthAmerica/PCNA/STAR2/Request"
xmlns:ns1="http://www.ABC.com/NorthAmerica/PCNA/STAR2/Owner" name="Untitled" targetNamespace="http://www.ABC.com/NorthAmerica/PCNA/STAR2OwnerList/GetSTAR2OwnerImpl">
    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.ABC.com/NorthAmerica/PCNA/STAR2/Owner"
targetNamespace="http://www.ABC.com/NorthAmerica/PCNA/STAR2/Owner" elementFormDefault="unqualified"
attributeFormDefault="unqualified">
            <xsd:element name="Owner">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="OwnerID" type="xsd:string"/>
                        <xsd:element name="AddressID" type="xsd:string"/>
                        <xsd:element name="MSANumber" type="xsd:string"/>
                        <xsd:element name="OwnerINITNGSouce" type="xsd:string"/>
                        <xsd:element name="OwnerType" type="xsd:string"/>
                        <xsd:element name="OwnerName" type="xsd:string"/>
                        <xsd:element name="OwnerStatus" type="xsd:string"/>
                        <xsd:element name="OwnerCD" type="xsd:string"/>
                        <xsd:element name="CustomerGLN" type="xsd:string"/>
                        <xsd:element name="CustomerToLINXNumber" type="xsd:string"/>
                        <xsd:element name="InfoUSANumber" type="xsd:string"/>
                        <xsd:element name="FedEXTaxID" type="xsd:string"/>
                        <xsd:element name="DUNSPlusFour" type="xsd:string"/>
                        <xsd:element name="MSAHGHROwnerNumber" type="xsd:string"/>
                        <xsd:element name="OwneNumber" type="xsd:string"/>
                        <xsd:element name="DistributorFlag" type="xsd:string"/>
                        <xsd:element name="Status" type="xsd:string"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="OwnerGroup">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element ref="ns1:Owner" maxOccurs="unbounded"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="STAR2Owner">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element ref="ns1:OwnerGroup"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.ABC.com/NorthAmerica/PCNA/STAR2/Request"
targetNamespace="http://www.ABC.com/NorthAmerica/PCNA/STAR2/Request" elementFormDefault="qualified"
attributeFormDefault="unqualified">
            <xsd:element name="BusinessID" type="xsd:string"/>
            <xsd:element name="Header">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element ref="ns0:BusinessID" minOccurs="0"/>
                        <xsd:element ref="ns0:SourceSystemID" minOccurs="0"/>
                        <xsd:element ref="ns0:SourceSystemName" minOccurs="0"/>
                        <xsd:element ref="ns0:RequestType" minOccurs="0"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="RequestType" type="xsd:string"/>
            <xsd:element name="SourceSystemID" type="xsd:string"/>
            <xsd:element name="SourceSystemName" type="xsd:string"/>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="OwnerRequest">
        <wsdl:part name="HeaderInput" element="ns0:Header"/>
    </wsdl:message>
    <wsdl:message name="OwnerResponse">
        <wsdl:part name="ResponseOutput" element="ns1:STAR2Owner"/>
    </wsdl:message>
    <wsdl:portType name="OwnerPortType">
        <wsdl:operation name="GetSTAR2Owner">
            <wsdl:input message="tns:OwnerRequest"/>
            <wsdl:output message="tns:OwnerResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="SOAPEventSourceBinding" type="tns:OwnerPortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="GetSTAR2Owner">
            <soap:operation style="document" soapAction="/Processes/ProvideSTAR2Owner"/>
            <wsdl:input>
                <soap:body use="literal" parts="HeaderInput"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" parts="ResponseOutput"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="ProvideSTAR2Owner">
        <wsdl:port name="SOAPEventSource" binding="tns:SOAPEventSourceBinding">
            <soap:address location="http://localhost:7989/Processes/ProvideSTAR2Owner"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>



thanks



-----Original Message-----
From: Walker, Jeff [mailto:Jeff.Walker@fmr.com]
Sent: Wed 7/25/2007 4:02 PM
To: axis-user@ws.apache.org
Subject: RE: HTTP error in Axis client
 
Actually,
The 404 means the web server was hit by the client, but the server
couldn't fulfill the request for some unknown reason.
See http://en.wikipedia.org/wiki/404_error
Suggest you get the wsdl of the web service, and attempt to rebuild the
client from that again.

Also, you need to post the version of Axis you use, the WSDL of the
service as well, and any other pertinent details.
The Axis experts here can read wsdl faster than we can talk, and they
often zoom into the problem fairly quickly.
-jeff

-----Original Message-----
From: Kumar, Amit {PBSG} [mailto:amit.kumar1@pbsg.com] 
Sent: Wednesday, July 25, 2007 4:24 PM
To: axis-user@ws.apache.org
Subject: HTTP error in Axis client
Importance: High

Hi,

I am new to Axis. I am running into an issue while invoking a webservice
from an Axis client. The webservice is deployed and running. I have
verified the endpoint URL. The webservice is not getting hit from the
client. Both webservice and the client are running on the same machine.

Below is the error message.

Thanks in advance.

best regards
amit


 faultCode: {http://xml.apache.org/axis/}HTTP
 faultSubcode: 
 faultString: (404)404 
 faultActor: 
 faultNode: 
 faultDetail: 
	{}:return code:  404
	{http://xml.apache.org/axis/}HttpErrorCode:404

(404)404 
	at
org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java
:744)
	at
org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
	at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.j
ava:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
	at org.apache.axis.client.Call.invoke(Call.java:2767)
	at org.apache.axis.client.Call.invoke(Call.java:1910)
	at webserviceCall.main(webserviceCall.java:82)


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org



Mime
View raw message