Are you certain that you've specified the correct SOAPAction value? You can
find this value in the SOAP binding description in the WSDL. You might find
it easier to generate a client stub using wsdl2java. Then you won't need to
painstakingly figure out what values you need to set in the Call object.
Also -- I would expect that a .NET service uses document/literal rather than
RPC/encoded, so you will also need to set the style and use attributes in
the Call object. (See the previous response from Jeff Walker for
instructions for generating the client stub.)
Anne
On 10/19/07, Sudhir Sharma <[EMAIL PROTECTED]> wrote:
>
> Hi Anne,
>
>
>
> Thanx for the advice.
>
> As mentioned in the trailing mail I have created a java client to consume
> a .NET web service.
>
> I am sending the code for the same.I am trying to call to call a call the
> getProduct method of the webservice. The product is returned based on the
> product key( say 123xxx). But I am getting one error for this. can anyone
> help me out on this.
>
>
>
> Thanx in advance.
>
>
>
> The code for the client is:
>
>
>
> import java.io.PrintStream;
>
> import java.net.URL;
>
> import javax.xml.namespace.QName;
>
> import org.apache.axis.client.Call;
>
> import org.apache.axis.client.Service;
>
>
>
>
>
> public class GetProduct {
>
>
>
> public GetProduct() {}
>
>
>
>
>
> public static void main(String args[])
>
> {
>
> try
>
> {
>
> String endpoint = "
> http://e1la41-320-10.infolabs.com/Iogatewaywebservice/productservice.asmx
> ";
>
> Service service = new Service();
>
> Call call = (Call)service.createCall();
>
> call.setTargetEndpointAddress(new URL(endpoint));
>
> call.setSOAPActionURI("
> http://e1la41-320-10.infolabs.com/Iogatewaywebservice/productservice.asmx/getProduct
> ");
>
> //call.setUseSOAPAction(true);
>
> call.setOperationName(new QName("
> http://e1la41-320-10.infolabs.com/","getProduct"));
>
> String ret = (String)call.invoke("getProduct",new Object[]
> {"123xxx"});
>
> System.out.println(ret);
>
> }
>
> catch(Exception e)
>
> {
>
> System.err.println(e.toString());
>
> }
>
> }
>
>
>
> }
>
>
>
>
>
> And the error for the code is:
>
>
>
> Server did not recognize the value of HTTP Header SOAPAction:
> http://e1la41-320-10.infolabs.com/Iogatewaywebservice/productservice.asmx/getProduct
> .
>
>
>
>
>
> Thanks & Best Regards,
>
> *Sudhir Sharma*
> ------------------------------
>
> *From:* Anne Thomas Manes [mailto:[EMAIL PROTECTED]
> *Sent:* Friday, October 19, 2007 5:58 PM
> *To:* [email protected]
> *Subject:* Re: java client from wsdl
>
>
>
> Be aware -- Yogesh's example is for Axis2. You indicated that you were
> using Axis 1.4, so Yogesh's example won't work for you. Jeff's suggestion
> is more applicable to your needs.
>
> Anne
>
> On 10/19/07, *Sudhir Sharma* <[EMAIL PROTECTED]> wrote:
>
> Thanx yogesh. I will try out this
>
>
>
> Thanks & Best Regards,
>
> *Sudhir Sharma*
> ------------------------------
>
> *From:* [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]
> *Sent:* Friday, October 19, 2007 3:01 AM
> *To:* [email protected]
> *Subject:* Re: java client from wsdl
>
>
>
>
> Try looking MTOM sample in axis. replace your wsdl here.
>
>
>
> <!-- Generate Client -->
> <target name="generate.client">
> <java classname="org.apache.axis2.wsdl.WSDL2Java">
> <arg value="-uri" />
> <arg value="resources/MTOMSample.wsdl" />
> <arg value="-p" />
> <arg value="-ap" />
> <arg value="sample.mtom.service" />
> <arg value="-o" />
> <arg value="${client.dir}" />
> <classpath refid="class.path" />
> </java>
>
> <copy file="${client.path}" tofile="${client.dir}/${
> client.path}" overwrite="true" />
>
> <mkdir dir="${client.classes.dir}" />
> <!-- Compile client -->
> <javac srcdir="${client.dir}/src" destdir="${
> client.classes.dir}">
> <classpath refid="class.path" />
> </javac>
> </target>
>
> *"Sudhir Sharma" <[EMAIL PROTECTED]>*
>
> 10/18/2007 10:12 AM
>
> Please respond to
> [email protected]
>
> To
>
> <[email protected] >
>
> cc
>
>
>
> Subject
>
> java client from wsdl
>
>
>
>
>
>
>
>
>
>
> Hi,
>
> I am new to web services and axis. I have a webservice in .NET that is
> into production. I need to make a java client from the wsdl of that web
> service.can anyone help me how to automaticaly generate a java client from
> the wsdl.I am using axis 1.4 and Tomcat 5.0
>
> Thanx in advance.
>
> Thanks & Best Regards,
> *Sudhir Sharma*
>
>
> *======================================================================================================
>
> This transmittal and any attachments may contain confidential, privileged
> or sensitive information and is solely for the use of the intended
> recipient. If you are not the intended recipient, you are hereby notified
> that you have received this transmittal and any attachments in error and any
> review, dissemination, distribution or copying thereof is strictly
> prohibited. If you have received this transmittal and any attachments in
> error please notify the sender and immediately destroy the message and all
> its attachments. Any opinions herein expressed may be those of the author
> and not necessarily of Mizuho Corporate Bank, Ltd., Mizuho Corporate Bank
> (USA), Mizuho Securities USA Inc. or any other affiliates of Mizuho
> Financial Group ("Mizuho"). Mizuho accepts no responsibility for the
> accuracy or completeness of any information herein contained.
> E-Mail received by or sent from officer of Mizuho Securities USA Inc.
> (which is a registered U.S. broker-dealer and the entity through which
> Mizuho generally conducts its investment banking, capital markets, and
> securities business in the United States) is electronically archived and
> recorded and is subject to review and monitoring by and/or disclosure to
> persons other than the recipient, including (but not limited to) Mizuho
> Securities USA Inc. supervisory personnel. Such communications may be
> produced to regulatory authorities or others with legal rights to the
> information.*
>
>
>