users@jax-rpc.java.net

Re: SOAP invocation

From: Anne Thomas Manes <atmanes_at_gmail.com>
Date: Thu, 24 Feb 2005 22:26:49 -0500

The problem is that you're setting the wrong namespace for your
message. According to the WSDL document, the namespace for the
"convert" operation should be "urn:foo":

> - <operation name="convert">
> - <input>
> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:Foo" />
> </input>

But in your application, you're setting the namespace to
"MyCurrencyConverterAspectsService".

Change this:

          SOAPFactory soapFactory =
                SOAPFactory.newInstance();
          Name bodyName = envelope.createName("convert", "foo",
                "MyCurrencyConverterAspectsService");
            SOAPBodyElement convert = body.addBodyElement(bodyName);

to this:

          SOAPFactory soapFactory =
                SOAPFactory.newInstance();
          Name bodyName = envelope.createName("convert", "foo",
                "urn:foo");
            SOAPBodyElement convert = body.addBodyElement(bodyName);

and it should work.


On Thu, 24 Feb 2005 09:53:58 +0100, Guadalupe Ortiz
<gobellot_at_hotmail.com> wrote:
> Sorry; I was just posting the address for indicating it was the same as in
> the URL element. Here goes my WSDL:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> - <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:Foo"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> name="MyCurrencyConverterAspectsService" targetNamespace="urn:Foo">
> <types />
> - <message name="CurrencyConverterAspectsIF_convert">
> <part name="String_1" type="xsd:string" />
> <part name="String_2" type="xsd:string" />
> <part name="String_3" type="xsd:string" />
> </message>
> - <message name="CurrencyConverterAspectsIF_convertResponse">
> <part name="result" type="xsd:string" />
> </message>
> - <portType name="CurrencyConverterAspectsIF">
> - <operation name="convert" parameterOrder="String_1 String_2 String_3">
> <input message="tns:CurrencyConverterAspectsIF_convert" />
> <output message="tns:CurrencyConverterAspectsIF_convertResponse" />
> </operation>
> </portType>
> - <binding name="CurrencyConverterAspectsIFBinding"
> type="tns:CurrencyConverterAspectsIF">
> - <operation name="convert">
> - <input>
> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:Foo" />
> </input>
> - <output>
> <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:Foo" />
> </output>
> <soap:operation soapAction="" />
> </operation>
> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"
> />
> </binding>
> - <service name="MyCurrencyConverterAspectsService">
> - <port name="CurrencyConverterAspectsIFPort"
> binding="tns:CurrencyConverterAspectsIFBinding">
> <soap:address xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> location="http://localhost:8080/currencyConverterAspects-jaxrpc/currencyConv
> erterAspects" />
> </port>
> </service>
> </definitions>
>
> Thanks for your time,
> Guadalupe
>
> ----- Original Message -----
> From: "Anne Thomas Manes" <atmanes_at_gmail.com>
> To: <users_at_jax-rpc.dev.java.net>
> Sent: Wednesday, February 23, 2005 9:42 PM
> Subject: Re: SOAP invocation
>
> > Please post the WSDL file. (we can't access it from your localhost(
> >
> > The message indicates that it doesn't recognize the operation name.
> >
> > Anne
> >
> >
> > On Wed, 23 Feb 2005 10:28:46 +0100, Guadalupe Ortiz
> > <gobellot_at_hotmail.com> wrote:
> > >
> > > Related to my previous question. I am trying to build a SOAP message
> > > (without using JAXRPC) to invoke a JAXRPC service.
> > > The service is at
> > >
> http://localhost:8080/currencyConverterAspects-jaxrpc/currencyConverterAspects?WSDL
> > >
> > > And it offers one operation, convert, with three string parametres. The
> code
> > > I execute is:
> > > SOAPConnectionFactory soapConnectionFactory =
> > > SOAPConnectionFactory.newInstance();
> > > SOAPConnection connection =
> > > soapConnectionFactory.createConnection();
> > > MessageFactory messageFactory =
> > > MessageFactory.newInstance();
> > >
> > > SOAPMessage message =
> > > messageFactory.createMessage();
> > >
> > > SOAPPart part = message.getSOAPPart();
> > > SOAPEnvelope envelope = part.getEnvelope();
> > > SOAPBody body = envelope.getBody();
> > >
> > > SOAPFactory soapFactory =
> > > SOAPFactory.newInstance();
> > > Name bodyName = envelope.createName("convert", "foo",
> > > "MyCurrencyConverterAspectsService");
> > > SOAPBodyElement convert = body.addBodyElement(bodyName);
> > >
> > >
> > > Name amountName = envelope.createName("String_1");
> > > SOAPElement amount = convert.addChildElement(amountName);
> > > amount.addTextNode("10");
> > > Name fromCurrencyName = envelope.createName("String_2");
> > > SOAPElement fromCurrency =
> > > convert.addChildElement(fromCurrencyName);
> > > fromCurrency.addTextNode("USD");
> > > Name toCurrencyName = envelope.createName("String_3");
> > > SOAPElement toCurrency=
> convert.addChildElement(toCurrencyName);
> > > toCurrency.addTextNode("EUR");
> > >
> > > message.saveChanges();
> > >
> > > System.out.println("\n--- Request Message ---\n");
> > > message.writeTo(System.out);
> > >
> > > URL endpoint = new
> > >
> URL("http://localhost:8080/currencyConverterAspects-jaxrpc/currencyConverter
> Aspects");
> > >
> > > SOAPMessage reply =
> > > connection.call(message, endpoint);
> > >
> > > System.out.println("\n\nReceived reply from: " +
> > > endpoint);
> > > System.out.println("\n---- Reply Message ----\n");
> > >
> > > reply.writeTo(System.out);
> > >
> > > The fault code I receive in a SOAP faultString is:
> > > [...]<faultString>JAXRPC.TIE01: caugh exception while handling
> request:
> > > unrecognized operation
> > > {MyCurrencyConverterAspectsService}convert</faultString>
> > >
> > > Any clue about what I am doing wrong? Thanks in advance,
> > > Guadalupe
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> > For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>