axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dong Liu <edong...@gmail.com>
Subject Re: could someone help me in java client to invoke webservices?
Date Wed, 01 Feb 2006 20:53:24 GMT
Please try after adding this line into your client

call.setSOAPActionURI("Operation");

Cheers,

Don


On 2/1/06, mm jj <metibco@yahoo.com> wrote:
>
> thanks for reply. could you please look into the following code, error and
> WSDL.
>
> 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<http://dusu41009x1/Processes/SOAPServer>
> ";
>     //String endpoint = "http://DUSU41009X1:8080/Processes_sp_Definition<http://dusu41009x1:8080/Processes_sp_Definition>
> ";
>     String Sub = "SUBJECT";
>     String Data = "DATA";
>     Service service = n ew 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 an d
> javax.mail.internet.MimeMultipart). Attachment support is disabled.
> AxisFault
>  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client<http://schemas.xmlsoap.org/soap/envelope/%7DClient>
>  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"/<http://schemas.xmlsoap.org/soap/http%22/>
> >
>         <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"/<http://ubs/Processes/SOAPServer%22/>
> >
>         </wsdl:port>
>     </wsdl:service>
> </wsdl:definitions>
>
>
> *Glenn Bech <glenn.bech@webstep.no>* wrote:
>
>  Public class Test {
>
>    Public static void main(String[] args) {
>
> String wsdlURI = "http://localhost:8888/axis/myService.wsdl";
> String nsURI = "http://schemnamespace/2004/01/22/";
> String endPointURI = "http://localhost:8888/axis/services/Provisioning/";
> String serviceName = "MyServiceName";
> String portNameProv = "MyPortName";
>
> ServiceFactory serviceFactory = ServiceFactory.newInstance();
> Service provisioningService = serviceFactory.createService(new
> URL(wsdlURI), new QName(nsURI, serviceName));
> SessionControlStub sessionControlStu b = new SessionControlStub(new
> URL(endPointURI), provisioningService);
>
> Object returnValue = sessionControlStub.login(argument);
>    }
> }
>
>
>
>  ------------------------------
>  *From:* mm jj [mailto:metibco@yahoo.com]
> *Sent:* 1. februar 2006 18:33
> *To:* axis-user@ws.apache.org
> *Subject:* could someone help me in java client to invoke webservices?
>
>  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.<http://us.rd.yahoo.com/mail_us/taglines/mailstorage/*http:/mail.yahoo.com/>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

Mime
View raw message