Note that there are some explanatory texts on larger screens.

plurals
  1. POI am able to write a javax.jws.WebService successfully. However I do not know exactly how to write a web service client for same in java
    primarykey
    data
    text
    <p>I have written Webservice in java which has successfully created WSDL. I am stuck in writing a webservice client for my webservice in java. I would like to use my webservice from some jsp classes. How do i do it?</p> <pre><code>@WebService public interface AddService { double getMultipicationResult(double M1, double M2); } @WebService(endpointInterface = "com.sample.AddService") public class AddServiceImpl implements AddService { public AddServiceImpl() { } @Override public double getMultipicationResult(double M1, double M2) { M1 = M1*M2; return M1; } } </code></pre> <p>I have written the client something like :-</p> <pre><code>public class AddServiceClient { private AddServiceClient() { } public static void main(String args[]){ { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"SpringClientWebServices.xml"}); AddService client = (AddService)context.getBean("client"); double response = 0.0; response = client.getMultipicationResult(10.0, 20.5); } } </code></pre> <p>and SpringClientWebServices.xml is as follows :-</p> <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"&gt; &lt;bean id="client" class="com.sample.AddService" factory-bean="clientFactory" factory-method="create"/&gt; &lt;bean id="clientFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean"&gt; &lt;property name="serviceClass" value="com.sample.AddService"/&gt; &lt;property name="address" value="http://localhost:8080/sample/services/Addition"/&gt; &lt;/bean&gt; &lt;/beans&gt; </code></pre> <p>I am getting exception as follows:-</p> <pre><code>Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.cxf.jaxws.JaxWsProxyFactoryBean] for bean with name 'clientFactory' defined in class path resource [SpringClientWebServices.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.cxf.jaxws.JaxWsProxyFactoryBean </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload