axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mm jj <meti...@yahoo.com>
Subject Re: could someone help me in java client to invoke webservices?
Date Wed, 01 Feb 2006 19:13:09 GMT
thanks for reply.
   
  here is the code, error, and wsdl(this wsdl is created in TIBCO). I used AXIS 1.3 to write
and compile java code.
   
  import org.apache.axis.client.*;
import javax.xml.rpc.ParameterMode;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;
   
  public class FibClient {
  public static void main(String[] args) throws Exception {
    String endpoint = "http://DUSU41009X1:80/Processes/SOAPServer";
    //String endpoint = "http://DUSU41009X1:8080/Processes_sp_Definition";
    String Sub = "SUBJECT";
    String Data = "DATA";
    Service service = new Service();
    Call call = (Call) service.createCall();
    call.setTargetEndpointAddress(endpoint);
    call.setOperationName("Operation");
    call.setProperty(Call.OPERATION_STYLE_PROPERTY, "wrapped");
    call.addParameter("op1", XMLType.XSD_STRING, ParameterMode.IN);
    call.addParameter("op2", XMLType.XSD_STRING, ParameterMode.IN);
    call.setReturnType(XMLType.XSD_STRING);
    call.setReturnType(XMLType.XSD_STRING);
    String ret = (String) call.invoke(new Object[]{Sub, Data});
    System.out.println("Got result : " + ret);
    
    
    
  }
}
--------------------------
   
  init:
deps-jar:
compile-single:
run-single:
- Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart).
Attachment support is disabled.
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
 faultSubcode: 
 faultString: No handler for body element
 faultActor: 
 faultNode: 
 faultDetail: 
        {}detail:<transportUri>http://DUSU41009X1:80/Processes/SOAPServer</transportUri><soapAction>&quot;&quot;</soapAction><element>Operation</element>
  No handler for body element
        at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
        at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
        at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1712)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
        at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
        at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
        at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
        at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
        at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
        at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
        at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
        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:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at FibClient.main(FibClient.java:24)
Exception in thread "main" 
Java Result: 1
BUILD SUCCESSFUL (total time: 1 second)
   
  ----------------------------------------------
   
  <?xml version="1.0" encoding="UTF-8"?>
<!--Created by TIBCO WSDL-->
<wsdl:definitions xmlns:ns0="www.examples.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://xmlns.example.com/1138294660453/OperationImpl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
name="Untitled" targetNamespace="http://xmlns.example.com/1138294660453/OperationImpl">
    <wsdl:types>
        <xs:schema xmlns="www.examples.com" xmlns:xs="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="www.examples.com">
            <xs:element name="WS_REPLY">
                <xs:annotation>
                    <xs:documentation>Generic web service request</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="STATUS" type="xs:string"/>
                        <xs:element minOccurs="0" name="DATA" type="xs:string">
                            <xs:annotation>
                                <xs:documentation>insert the reply XML here</xs:documentation>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="WS_REQUEST">
                <xs:annotation>
                    <xs:documentation>Generic web service request</xs:documentation>
                </xs:annotation>
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="SUBJECT" type="xs:string"/>
                        <xs:element name="DATA" type="xs:string">
                            <xs:annotation>
                                <xs:documentation>insert the request XML here</xs:documentation>
                            </xs:annotation>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="Request">
        <wsdl:part element="ns0:WS_REQUEST" name="Request"/>
    </wsdl:message>
    <wsdl:message name="Response">
        <wsdl:part element="ns0:WS_REPLY" name="Response"/>
    </wsdl:message>
    <wsdl:portType name="PortType">
        <wsdl:operation name="Operation">
            <wsdl:input message="tns:Request"/>
            <wsdl:output message="tns:Response"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="SOAPServerBinding" type="tns:PortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="Operation">
            <wsdl:documentation>The operation has no documentation</wsdl:documentation>
            <soap:operation soapAction="/Processes/SOAPServer" style="document"/>
            <wsdl:input>
                <soap:body parts="Request" use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body parts="Response" use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="SOAPServer">
        <wsdl:port binding="tns:SOAPServerBinding" name="SOAPServerHttpPort">
            <soap:address location="http://ubs:80/Processes/SOAPServer"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

Dong Liu <edongliu@gmail.com> wrote:
  Please post the details of your questions here, otherwise no one could give you an answer.

A good start point is always the code samples coming with the release. 

Cheers

Don

  On 2/1/06, mm jj <metibco@yahoo.com> wrote:    could someone help me in java client
to invoke webservices?
  
  
---------------------------------
  Do you Yahoo!?
With a free 1 GB, there's more in store with Yahoo! Mail.   


  


		
---------------------------------
 
 What are the most popular cars? Find out at Yahoo! Autos 
Mime
View raw message