After looking around the forum, I found an old post that was similar to my
problem:

http://cwiki.apache.org/SM/discussion-forums.html#nabble-td21843894%7Ca21844247
http://cwiki.apache.org/SM/discussion-forums.html#nabble-td21843894%7Ca21844247 

I finally managed to get things working after following the advice from that
thread.  So here's what I did:

I started from scratch and created a simple Echo Web Service using Eclipse
WTP and hosted it in tomcat.  Important parts of the WSDL are shown below:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; ...
targetNamespace="http://com.fujitsu.nz";>
...
<wsdl:service name="Echo">
        <wsdl:port name="EchoSOAP11port_http"
binding="ns0:EchoSOAP11Binding">

            <soap:address
location="http://localhost:80/MockWebService/services/Echo"/>
        </wsdl:port>
        <wsdl:port name="EchoSOAP12port_http"
binding="ns0:EchoSOAP12Binding">
            <soap12:address
location="http://localhost:80/MockWebService/services/Echo"/>
        </wsdl:port>
        <wsdl:port name="EchoHttpport" binding="ns0:EchoHttpBinding">
            <http:address
location="http://localhost:80/MockWebService/services/Echo"/>
        </wsdl:port>
    </wsdl:service>


The WSDL was generated using Axis2 runtime in Eclipse, that's why I get the
different port names for http,
soap1.1 and soap1.2.

Here's my xbean.xml definition:

<beans xmlns:http="http://servicemix.apache.org/http/1.0";
       xmlns:ns="http://com.fujitsu.nz"; ...

  <http:endpoint service="ns:Echo"
                 endpoint="EchoSOAPConsumer"
                 role="consumer"            
                 targetService="ns:Echo"    
                 targetEndpoint="EchoSOAP11port_http"                           
                      
                 locationURI="http://localhost:8192/EchoService/";
                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out";
                 soap="true"
                 soapVersion="1.1"/>
                 

  <http:endpoint service="ns:Echo"
                 endpoint="EchoSOAP11port_http"
                 role="provider"                 
                
locationURI="http://localhost:80/MockWebService/services/Echo";
                
wsdlResource="http://localhost:80/MockWebService/services/Echo?wsdl";
                 soap="true"
                 soapVersion="1.1"
                 soapAction="getMessage"/>  

</beans>

1.  It is important that the targetNamespace value used in the wsdl be the
same as that in the xbean.xml.  From the WSDL above the targetNamespace is
http://com.fujitsu.nz which is the same as
xmlns:ns="http://com.fujitsu.nz"; in xbean.xml.

2.  Notice that the service names for both the consumer and provider are the
same.  This should also be named exactly as what is in the WSDL:

<wsdl:service name="Echo">

3.  The value that made everything come together was the endpoint value in
the provider definition.  The provider endpoint value was exactly one of the
port names defined in the WSDL:

xbean.xml: 

<http:endpoint service="ns:Echo"
                 endpoint="EchoSOAP11port_http"  ...

WSDL:

<wsdl:service name="Echo">
        <wsdl:port name="EchoSOAP11port_http"
binding="ns0:EchoSOAP11Binding">  ...

4.  Lastly, in the consumer definition ensure that the targetEndpoint value
is the same as the endpoint value in the provider definition:

consumer:
   role="consumer"            
   targetService="ns:Echo"    
   targetEndpoint="EchoSOAP11port_http" 

provider:
   endpoint="EchoSOAP11port_http"
   role="provider" 


That's it.  I struggled with this problem for a while so I hope this helps
with those having the same problem.

Thanks to Freeman for his time in helping out.



Freeman Fang wrote:
> 
> Could you send me the full debug log when you try to access 
> http://localhost:8192/EchoService/main.wsdl from your browser?
> Freeman
> 
> angeloNZ wrote:
>> I wasn't getting any sort of exception when deploying the SA with the
>> consumer and provider servicename the same.  I've now tried changing the
>> name of the consumer service and still get the unable to find the
>> requested
>> resource problem.
>>
>> I can get the external web service's wsdl to show up in the browser by
>> doing
>> http://localhost/MockWebService/services/EchoService?wsdl
>> and I can make requests to it's methods when using a soapUI client as
>> well.
>>
>> So I'm not really sure what else to look for.
>>
>> Here's what I get from turning on DEBUG whenever I try to access
>> .../EchoService/main.wsdl
>>
>> DEBUG - jetty                          - chain=null
>> DEBUG - jetty                          - servlet holder=jbiServlet
>> DEBUG - jetty                          - RESPONSE /EchoService/main.wsdl 
>> 404
>> DEBUG - jetty                          - REQUEST /EchoService/main.wsdl
>> on
>> org.mortbay.jetty.HttpC
>> onnect...@1b6c74
>> DEBUG - jetty                          - servlet=jbiServlet
>> DEBUG - jetty                          - chain=null
>> DEBUG - jetty                          - servlet holder=jbiServlet
>> DEBUG - jetty                          - RESPONSE /EchoService/main.wsdl 
>> 404
>>
>>
>> Freeman Fang wrote:
>>   
>>> Hi,
>>>
>>> Are you sure your SA get deployed successfully?  I notice your http 
>>> consumer and provider has same servicename which should cause conflict 
>>> when deploy your SA.
>>> Could see any exception from servicemix console when you deploy the SA?
>>> Also, you use
>>> wsdlResource="http://localhost/MockWebService/services/EchoService?wsdl";
>>> to refer the wsdl, which means the service already exposed from 
>>> http://localhost/MockWebService/services/EchoService
>>> Could you access the 
>>> http://localhost/MockWebService/services/EchoService?wsdl from your web 
>>> browser?
>>> Freeman
>>> angeloNZ wrote:
>>>     
>>>> thanks for your reply Freeman.  
>>>>
>>>> however, using http://localhost:8192/EchoService/main.wsdl gives me the
>>>> same
>>>> resource not found problem.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>   
>>>>       
>>>
>>>     
>>
>>   
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/http-binding-problem-displaying-the-WSDL-tp21843894p21923959.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to