Hi Freeman!

Freeman Fang пишет:
Please append your whole wsdl

Originally wsdl has 2 operations and several custom types (in given below I pasted simple xsd:string types). I don't think it does matter, what is hidden inside RequestMessage/ResponseMessage. There are no one includes in wsdl (all types are in section wsdl:types).

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
        xmlns:tns="http://mycompany/My";
        xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
        xmlns:xmime="http://www.w3.org/2005/05/xmlmime";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";
        xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/";
        targetNamespace="http://mycompany/My";>
        <wsdl:types>
                <xsd:schema targetNamespace="http://mycompany/My";
                        attributeFormDefault="qualified" 
elementFormDefault="qualified">
                        <xsd:element name="RequestMessage">
                                <xsd:complexType>
                                        <xsd:sequence>
                                                <xsd:element name="input"
                                                        type="xsd:string" />
                                                <xsd:element name="input2"
                                                        type="xsd:string" />    
                                                                                             
      
                                        </xsd:sequence>
                                </xsd:complexType>
                        </xsd:element>
                        <xsd:element name="ResponseMessage">
                                <xsd:complexType>
                                        <xsd:sequence>
                                                <xsd:element name="output"
                                                        type="xsd:string" />
                                                <xsd:element name="output2"
                                                        type="xsd:string" />
                                        </xsd:sequence>
                                </xsd:complexType>
                        </xsd:element>                    
                </xsd:schema>
        </wsdl:types>

        <wsdl:message name="requestMessage">
                <wsdl:part name="request"
                        element="tns:RequestMessage">
                </wsdl:part>
        </wsdl:message>
        <wsdl:message name="responseMessage">
                <wsdl:part name="result"
                        element="tns:ResponseMessage">
                </wsdl:part>
        </wsdl:message>
                
        <wsdl:portType name="MyServiceInterface">
                <wsdl:operation name="getInfo">
                        <wsdl:input message="tns:requestMessage">
                        </wsdl:input>
                        <wsdl:output message="tns:responseMessage">
                        </wsdl:output>
                </wsdl:operation>
        </wsdl:portType>

        <wsdl:binding name="MyServicePortBinding"
                type="tns:MyServiceInterface">
                <soap:binding style="document"
                        transport="http://schemas.xmlsoap.org/soap/http"; />
                <wsdl:operation name="getInfo">
                        <soap:operation soapAction="" />
                        <wsdl:input>
                                <soap:body use="literal" />
                        </wsdl:input>
                        <wsdl:output>
                                <soap:body use="literal" />
                        </wsdl:output>
                </wsdl:operation>         
        </wsdl:binding>

        <wsdl:service name="MyService">
                <wsdl:port name="MyServicePort"
                        binding="tns:MyServicePortBinding">
                        <soap:address location="http://localhost:8192/myservice/"; 
/>
                </wsdl:port>
        </wsdl:service>
</wsdl:definitions>




  Thanks!
  Truly yours, Ivan Pryvalov.


Freeman

ivan wrote:
Hi Freeman!

I had 3 annotation in MyServiceImpl: only portName was missed.
I've added it. But exception stills...


Freeman Fang пишет:
Hi Ivan,

What's your MyServiceImp looks like?

make sure you have annotation like in this class
@WebService(serviceName = "MyService"
       portName = "MyServicePort",
       endpointInterface = "yourpackagename.MyServiceInterface",
       targetNamespace = "http://mycompany/My";)

Freeman

ivan wrote:
  Hi Freeman!

I tried it, but it didn't help... Exception is the same


org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://mycompany/My}MyServiceInterfaceService. at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:114) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:208) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:270) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:146) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:89) at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(AbstractEndpointFactory.java:83) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:107) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:147)



Freeman Fang пишет:
comment inline

ivan wrote:
Hi Freeman!


Freeman Fang пишет:
Hi Ivan,

Please append the xbean configuration and the wsdl, as well as the code piece you start client and server.

-------xbean.xml------------

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:cxfse="http://servicemix.apache.org/cxfse/1.0";>
    <cxfse:endpoint>
        <cxfse:pojo>
          <bean class="mycompany.MyServiceImpl" />
        </cxfse:pojo>
    </cxfse:endpoint>
</beans>


-------service.wsdl (shortly)-----------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
    xmlns:tns="http://mycompany/My";
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
    xmlns:xmime="http://www.w3.org/2005/05/xmlmime";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/";
    targetNamespace="http://mycompany/My";>
    <wsdl:types>
          ....
    </wsdl:types>

    <wsdl:message>
           ....
    </wsdl:message>

    <wsdl:portType name="MyServiceInterface">
        <wsdl:operation>
                     ....
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="MyServicePortBinding"
        type="tns:MyServiceInterface">
        <soap:binding style="document"
            transport="http://schemas.xmlsoap.org/soap/http"; />
        <wsdl:operation>
                     .....
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="MyService">
        <wsdl:port name="MyServicePort"
            binding="tns:MyServicePortBinding">
<soap:address location="http://localhost:8192/myservice/"; />
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>



---------code--------------

import java.net.URL;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import javax.xml.namespace.QName;

import org.apache.cxf.endpoint.Endpoint;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
import org.apache.cxf.service.model.ServiceInfo;
import org.apache.servicemix.tck.SpringTestSupport;
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext; import org.springframework.context.support.AbstractXmlApplicationContext;

public class CxfBcProviderConsumerTest extends SpringTestSupport {

    public void testBridge() throws Exception {

        URL wsdl = getClass().getResource("/service.wsdl");
        // start external service
JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
        factory.setServiceClass(MyServiceInterface.class);
        factory.setServiceBean(new MyServiceImpl());
        factory.setWsdlURL(wsdl.toString());
        factory.setServiceName(new QName("http://mycompany/My";,
                "MyService"));
factory.setBindingId("http://schemas.xmlsoap.org/wsdl/soap12/";); // comment out this line

You shouldn't specify soap12 binding for your server, since from your wsdl, you are using soap11
        String address = "http://localhost:9001/bridgetest";;
        factory.setAddress(address);
        Server server = factory.create();
        Endpoint endpoint = server.getEndpoint();
        endpoint.getInInterceptors().add(new LoggingInInterceptor());
endpoint.getOutInterceptors().add(new LoggingOutInterceptor()); ServiceInfo service = endpoint.getEndpointInfo().getService();
        assertNotNull(service);

        // start external client
    }

    @Override
    protected AbstractXmlApplicationContext createBeanFactory() {
        return new ClassPathXmlApplicationContext(
                "my_cxf_provider_consumer_bridge.xml");
    }

}


---------my_cxf_provider_consumer_bridge.xml-----

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:sm="http://servicemix.apache.org/config/1.0";
       xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0";
       xmlns:my="http://mycompany/My";>

  <sm:container id="jbi" embedded="true">
    <sm:endpoints>
      <cxfbc:consumer wsdl="/service.wsdl"
                      service="my:MyService"
                      endpoint="MyPort"
                      targetEndpoint="MyPortProxy"
                      targetService="my:MyService"
                      targetInterface="my:MyServiceInterface">
          <cxfbc:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
          </cxfbc:inInterceptors>
          <cxfbc:outInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
          </cxfbc:outInterceptors>
          <cxfbc:inFaultInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
          </cxfbc:inFaultInterceptors>
          <cxfbc:outFaultInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
          </cxfbc:outFaultInterceptors>
      </cxfbc:consumer>

      <cxfbc:provider wsdl="/service.wsdl"
                      locationURI="http://localhost:9001/bridgetest";
                      service="my:MyService"
                      endpoint="MyPortProxy"
                      interfaceName="my:MyServiceInterface"
                     >
          <cxfbc:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
          </cxfbc:inInterceptors>
          <cxfbc:outInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
          </cxfbc:outInterceptors>
          <cxfbc:inFaultInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
          </cxfbc:inFaultInterceptors>
          <cxfbc:outFaultInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
          </cxfbc:outFaultInterceptors>
      </cxfbc:provider>
    </sm:endpoints>

  </sm:container>

</beans>



---------------------MyServiceInterface.java(auto-generated)---------------

import javax.jws.WebParam.Mode;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding;
import javax.jws.WebMethod;
import javax.jws.WebResult;

/**
 * This class was generated by the CXF 2.0.2-incubator
 * Tue Apr 29 09:10:49 EEST 2008
 * Generated source version: 2.0.2-incubator
 *
 */

@WebService(targetNamespace = "http://mycompany/My";, name = "MyServiceInterface")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)

public interface MyServiceInterface {
    ....
}




  Truly yours, Ivan Pryvalov.



Freeman

ivan wrote:
  Hi!

I use as example CxfBcProviderConsumerTest.java for testing my service. But I faced some issues:


org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://mycompany.com/services/myservice}MyServiceInterfaceService. at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:114) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:208) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:270) at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:146) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:89) at org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(AbstractEndpointFactory.java:83) at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:107) at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:147)


It seems it is added "Service" in "MyServiceInterface".

JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
factory.setServiceClass(MyServiceInterface.class);
...



How did we get "MyServiceInterfaceService"? How to configure it properly?

I have WSDL file, and there are no one matches of "MyServiceInterfaceService". MyServiceInterface class - it is generated using CXF maven plug-in (servicemix version 3.2.1).




  Thanks,
  Truly yours,
  Ivan Pryvalov.
















Reply via email to