It's probably due to the operation name in the  wsdl being "Add" and the 
method name being "add".   Try adding:
@WebMethod(operation = "Add")

Also, add the appropriate @WebService annotation to the interface to specify 
the targetNamespace.

Dan



On Wed June 10 2009 1:00:03 pm sixman9 wrote:
> Hi,
> I'm having an issue getting Spring's (2.5.6) JaxWsPortProxyFactoryBean to
> create a proxy client bean while consuming some .NET-generated WSDL (WS-I
> Basic profile 1.1 compliant). So, I've create a simple service, which adds
> two numbers, to document the problem. What is stranger, however, is that
> the same WSDL does work with CXF's wsdl2java tool.
>
> [Before anyone asks, I like the Spring configured route, easier than
> integrating code stubs (which is why I haven't settled with wsdl2java)]
>
> The exception stack is (fragment) & some Log4j output:
>
> org.springframework.remoting.RemoteAccessException: Could not access remote
> service at [{addServiceNameSpace}AddNumbersSoap]; nested exception is
> javax.xml.ws.WebServiceException: Could not find wsdl:binding operation
> info for web method add.
>       at
> org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.doInvoke(JaxW
>sPortClientInterceptor.java:401) at
> org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.invoke(JaxWsP
>ortClientInterceptor.java:379) at
> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec
>tiveMethodInvocation.java:171) at
> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopPr
>oxy.java:204) at $Proxy33.add(Unknown Source)
>       at TestLocalAddService.testAdd(TestLocalAddService.java:30)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
>9) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
>l.java:25)
>
> [Log4j]
> 10-Jun-2009 16:43:38 org.apache.cxf.bus.spring.BusApplicationContext
> getConfigResources
> INFO: No cxf.xml configuration file detected, relying on defaults.
> 10-Jun-2009 16:43:39
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromWSDL
> INFO: Creating Service {addServiceNameSpace}AddNumbers from WSDL:
> http://localhost/ws/AddService.asmx?WSDL
> 10-Jun-2009 16:43:39
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> initializeWSDLOperations
> WARNING: Could not find a matching method for operation
> {addServiceNameSpace}Add. Operation will be unavailable.
>
> The [ASP .NET v2.0.50727] WSDL is:
>
> <?xml version="1.0" encoding="utf-8"?>
> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
> xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/";
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/";
> xmlns:tns="addServiceNameSpace" xmlns:s="http://www.w3.org/2001/XMLSchema";
> xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/";
> xmlns:http="http://schemas.xmlsoap.org/wsdl/http/";
> targetNamespace="addServiceNameSpace"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
>   <wsdl:types>
>     <s:schema elementFormDefault="qualified"
> targetNamespace="addServiceNameSpace">
>       <s:element name="Add">
>         <s:complexType>
>           <s:sequence>
>             <s:element minOccurs="1" maxOccurs="1" name="a" type="s:int" />
>             <s:element minOccurs="1" maxOccurs="1" name="b" type="s:int" />
>           </s:sequence>
>         </s:complexType>
>       </s:element>
>       <s:element name="AddResponse">
>         <s:complexType>
>           <s:sequence>
>             <s:element minOccurs="1" maxOccurs="1" name="AddResult"
> type="s:int" />
>           </s:sequence>
>         </s:complexType>
>       </s:element>
>     </s:schema>
>   </wsdl:types>
>   <wsdl:message name="AddSoapIn">
>     <wsdl:part name="parameters" element="tns:Add" />
>   </wsdl:message>
>   <wsdl:message name="AddSoapOut">
>     <wsdl:part name="parameters" element="tns:AddResponse" />
>   </wsdl:message>
>   <wsdl:portType name="AddNumbersSoap">
>     <wsdl:operation name="Add">
>       <wsdl:input message="tns:AddSoapIn" />
>       <wsdl:output message="tns:AddSoapOut" />
>     </wsdl:operation>
>   </wsdl:portType>
>   <wsdl:binding name="AddNumbersSoap" type="tns:AddNumbersSoap">
>     <wsdl:documentation>
>       <wsi:Claim conformsTo="http://ws-i.org/profiles/basic/1.1";
> xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/"; />
>     </wsdl:documentation>
>     <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; />
>     <wsdl:operation name="Add">
>       <soap:operation soapAction="addServiceNameSpace/Add" style="document"
> />
>       <wsdl:input>
>         <soap:body use="literal" />
>       </wsdl:input>
>       <wsdl:output>
>         <soap:body use="literal" />
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:binding name="AddNumbersSoap12" type="tns:AddNumbersSoap">
>     <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"; />
>     <wsdl:operation name="Add">
>       <soap12:operation soapAction="addServiceNameSpace/Add"
> style="document" />
>       <wsdl:input>
>         <soap12:body use="literal" />
>       </wsdl:input>
>       <wsdl:output>
>         <soap12:body use="literal" />
>       </wsdl:output>
>     </wsdl:operation>
>   </wsdl:binding>
>   <wsdl:service name="AddNumbers">
>     <wsdl:port name="AddNumbersSoap" binding="tns:AddNumbersSoap">
>       <soap:address location="http://localhost/ws/AddService.asmx"; />
>     </wsdl:port>
>     <wsdl:port name="AddNumbersSoap12" binding="tns:AddNumbersSoap12">
>       <soap12:address location="http://localhost/ws/AddService.asmx"; />
>     </wsdl:port>
>   </wsdl:service>
> </wsdl:definitions>
>
> And my Java interface to represent this service is:
>
> public interface AddServiceClient {
>     public int add(int a, int b);
> }
>
> And the Spring Config is:
>
> <beans xmlns="http://www.springframework.org/schema/beans";
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>   xmlns:jaxws="http://cxf.apache.org/jaxws";
>   xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";
>
>
>       <bean id="addServiceClient"
> class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
>               <property name="serviceInterface" 
> value="AddServiceClient"/><!-- The Java
> Interface -->
>               <property name="wsdlDocumentUrl"
> value="http://localhost/ws/AddService.asmx?WSDL"/>
>               <property name="namespaceUri" value="addServiceNameSpace"/>
>               <property name="serviceName" value="AddNumbers"/>
>               <property name="portName" value="AddNumbersSoap"/>
>       </bean>
>
> </beans>
>
> I'm stumped, but as I point out, the above WSDL works fine when run through
> wsdl2java (and with -validate set). Here is a snippet of the
> wsdl2java-generated code stub(s), you can clearly see the namespace etc.
> here:
>
> /**
>  * This class was generated by Apache CXF 2.1.3
>  * Wed Jun 10 16:04:55 BST 2009
>  * Generated source version: 2.1.3
>  *
>  */
>
>
> @WebServiceClient(name = "AddNumbers",
>                   wsdlLocation =
> "http://localhost/ws/AddService.asmx?WSDL";, targetNamespace =
> "addServiceNameSpace")
> public class AddNumbers extends Service {
>
>     public final static URL WSDL_LOCATION;
>     public final static QName SERVICE = new QName("addServiceNameSpace",
> "AddNumbers");
>     public final static QName AddNumbersSoap12 = new
> QName("addServiceNameSpace", "AddNumbersSoap12");
>     public final static QName AddNumbersSoap = new
> QName("addServiceNameSpace", "AddNumbersSoap");
>
> Can anyone tell me what I'm doing wrong?
>
> Cheers
>
> Rich

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to