You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Marco Piccinni <ma...@libero.it> on 2008/11/10 14:35:16 UTC
wsa action
Hi all!
I'm trying to generate a web application to consume the helloworld service. I used the tutorial online and that's the composite:
<?xml version="1.0" encoding="UTF-8"?>
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
xmlns:c="http://helloworld"
targetNamespace="http://helloworld"
name="helloworld">
<component name="HelloWorldComponent">
<implementation.java class="helloworld.HelloWorldImpl"/>
<service name="HelloWorld">
<binding.ws uri="http://localhost:9090/HelloWorld"/>
</service>
</component>
</composite>
and tht's the code I use to interface the wsdl generated on this composite by tuscany plugin:
package model;
import java.net.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
public class prova {
public prova() {
}
public String connessione() throws SOAPException, MalformedURLException {
// creo un oggetto soap di tipo call per effettuare la chiamata
Call call = new Call ();
URL url;
//setto dentro la call di soap l'identificativo del servizio
// call.setTargetObjectURI("urn:xmethodsBabelFish");
//dichiaro a quale url è in ascolto il servizio
url= new URL("http://localhost:9090/HelloWorld");
Vector param = new Vector ();
//secondo il meccanismo di soap serializzo le informazioni da inviare dentro ad un vettore
param.addElement (new Parameter("name", String.class, "Marco", null));
// param.addElement (new Parameter("sourcedata", String.class,sourcedata, null));
call.setParams (param);
//indico alla chiamata quale metodo invocare remotamente
call.setMethodName ("sayHello");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
//invoco il web service ed attendo la risposta
Response result = call.invoke (url, "");
//controllo se la risposta contiene degli errori
if (result.generatedFault ())
{
Fault fault = result.getFault();
throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
}
Parameter retValue = result.getReturnValue();
//ritorno castando a stringa il valore di ritorno dalla risposta
if (retValue != null) return (String)retValue.getValue ();
return "OPERAZIONE RIUSCITA";
}
}
This code is contained in a class wich methods are called by a jsp.
I create a .war file a I put it into the webapp tomcat folder: I obtain this message:
The endpoint reference (EPR) for the Operation not found is http://localhost:9090/HelloWorld and the WSA Action =
What does it mean?
If it could help the wsdl generated by tuscany plugin follow here:
<wsdl:definitions name="HelloWorldService" targetNamespace="http://helloworld/">
-
<wsdl:types>
-
<xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified" targetNamespace="http://helloworld/">
-
<xs:element name="sayHelloResponse">
-
<xs:complexType>
-
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
-
<xs:element name="sayHello">
-
<xs:complexType>
-
<xs:sequence>
<xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
-
<wsdl:message name="sayHelloResponse">
<wsdl:part name="sayHelloResponse" element="tns:sayHelloResponse">
</wsdl:part>
</wsdl:message>
-
<wsdl:message name="sayHello">
<wsdl:part name="sayHello" element="tns:sayHello">
</wsdl:part>
</wsdl:message>
-
<wsdl:portType name="HelloWorld">
-
<wsdl:operation name="sayHello">
<wsdl:input message="tns:sayHello">
</wsdl:input>
<wsdl:output message="tns:sayHelloResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
-
<wsdl:binding name="HelloWorldBinding" type="tns:HelloWorld">
<SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-
<wsdl:operation name="sayHello">
<SOAP:operation/>
-
<wsdl:input>
<SOAP:body use="literal"/>
</wsdl:input>
-
<wsdl:output>
<SOAP:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
-
<wsdl:service name="HelloWorldService">
-
<wsdl:port name="HelloWorldPort" binding="tns:HelloWorldBinding">
<SOAP:address location="http://10.10.4.236:9090/HelloWorld"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Thanks to all!!
Marco Piccinni
Re: wsa action
Posted by Raymond Feng <en...@gmail.com>.
Hi,
Are you trying to use an Axis2 generated client to talk to the helloworld WS
exposed by SCA? Which WSDL2Java tool did you use to generate the client?
Thanks,
Raymond
--------------------------------------------------
From: "Marco Piccinni" <ma...@libero.it>
Sent: Monday, November 10, 2008 5:35 AM
To: "user" <us...@tuscany.apache.org>
Subject: wsa action
> Hi all!
>
> I'm trying to generate a web application to consume the helloworld
> service. I used the tutorial online and that's the composite:
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
> xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
> xmlns:c="http://helloworld"
> targetNamespace="http://helloworld"
> name="helloworld">
>
> <component name="HelloWorldComponent">
> <implementation.java class="helloworld.HelloWorldImpl"/>
> <service name="HelloWorld">
> <binding.ws uri="http://localhost:9090/HelloWorld"/>
> </service>
> </component>
> </composite>
>
>
> and tht's the code I use to interface the wsdl generated on this composite
> by tuscany plugin:
>
>
> package model;
>
> import java.net.*;
> import java.util.*;
> import org.apache.soap.*;
> import org.apache.soap.rpc.*;
>
>
> public class prova {
>
> public prova() {
>
> }
> public String connessione() throws SOAPException, MalformedURLException {
> // creo un oggetto soap di tipo call per effettuare la chiamata
> Call call = new Call ();
> URL url;
>
>
> //setto dentro la call di soap l'identificativo del servizio
> // call.setTargetObjectURI("urn:xmethodsBabelFish");
>
> //dichiaro a quale url è in ascolto il servizio
> url= new URL("http://localhost:9090/HelloWorld");
> Vector param = new Vector ();
>
> //secondo il meccanismo di soap serializzo le informazioni da inviare
> dentro ad un vettore
> param.addElement (new Parameter("name", String.class, "Marco", null));
> // param.addElement (new Parameter("sourcedata",
> String.class,sourcedata, null));
> call.setParams (param);
>
> //indico alla chiamata quale metodo invocare remotamente
> call.setMethodName ("sayHello");
> call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>
> //invoco il web service ed attendo la risposta
> Response result = call.invoke (url, "");
>
> //controllo se la risposta contiene degli errori
> if (result.generatedFault ())
> {
> Fault fault = result.getFault();
> throw new SOAPException(fault.getFaultCode(),
> fault.getFaultString());
> }
> Parameter retValue = result.getReturnValue();
> //ritorno castando a stringa il valore di ritorno dalla risposta
> if (retValue != null) return (String)retValue.getValue ();
> return "OPERAZIONE RIUSCITA";
>
> }
>
> }
>
> This code is contained in a class wich methods are called by a jsp.
>
> I create a .war file a I put it into the webapp tomcat folder: I obtain
> this message:
>
> The endpoint reference (EPR) for the Operation not found is
> http://localhost:9090/HelloWorld and the WSA Action =
>
> What does it mean?
>
> If it could help the wsdl generated by tuscany plugin follow here:
>
> <wsdl:definitions name="HelloWorldService"
> targetNamespace="http://helloworld/">
> -
> <wsdl:types>
> -
> <xs:schema attributeFormDefault="qualified"
> elementFormDefault="unqualified" targetNamespace="http://helloworld/">
> -
> <xs:element name="sayHelloResponse">
> -
> <xs:complexType>
> -
> <xs:sequence>
> <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> -
> <xs:element name="sayHello">
> -
> <xs:complexType>
> -
> <xs:sequence>
> <xs:element minOccurs="0" name="arg0" nillable="true" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
> </wsdl:types>
> -
> <wsdl:message name="sayHelloResponse">
> <wsdl:part name="sayHelloResponse" element="tns:sayHelloResponse">
> </wsdl:part>
> </wsdl:message>
> -
> <wsdl:message name="sayHello">
> <wsdl:part name="sayHello" element="tns:sayHello">
> </wsdl:part>
> </wsdl:message>
> -
> <wsdl:portType name="HelloWorld">
> -
> <wsdl:operation name="sayHello">
> <wsdl:input message="tns:sayHello">
> </wsdl:input>
> <wsdl:output message="tns:sayHelloResponse">
> </wsdl:output>
> </wsdl:operation>
> </wsdl:portType>
> -
> <wsdl:binding name="HelloWorldBinding" type="tns:HelloWorld">
> <SOAP:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http"/>
> -
> <wsdl:operation name="sayHello">
> <SOAP:operation/>
> -
> <wsdl:input>
> <SOAP:body use="literal"/>
> </wsdl:input>
> -
> <wsdl:output>
> <SOAP:body use="literal"/>
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> -
> <wsdl:service name="HelloWorldService">
> -
> <wsdl:port name="HelloWorldPort" binding="tns:HelloWorldBinding">
> <SOAP:address location="http://10.10.4.236:9090/HelloWorld"/>
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
>
> Thanks to all!!
>
> Marco Piccinni
>