1

I am trying to consume a webservice produced on by following the tutorials in the mule Documentation. have been able to build the webservice successfully, but having issues consuming it. I have two Java Clasess "HelloWorld" and "HelloWorldImpl". This is my flow

<flow name="helloService" doc:name="helloService">
   <http:inbound-endpoint address="http://localhost:63081/hello" exchange-pattern="request-response" doc:name="HTTP">
       <cxf:jaxws-service serviceClass="com.test.HelloWorld"/>
   </http:inbound-endpoint>
   <component class="com.test.HelloWorldImpl" doc:name="Java"/>
   <cxf:jaxws-client serviceClass="com.test.HelloWorld" operation="sayHi" doc:name="SOAP" />
   <outbound-endpoint address="http://localhost:63081/services/greeter" doc:name="Generic"/>
</flow>

What am I doing wrong?

When I access the outbound endpoint I get

Cannot bind to address "http://activate.adobe.com:63081/services/greeter" No component     registered on that endpoint
philip
  • 484
  • 9
  • 26

4 Answers4

2

You have to make your endpoint accept all sub-paths and then handle wrong ones with message routing:

Example:

<flow name="jfeed_fill_data">
    <http:inbound-endpoint address="http://localhost:1212" />
    <choice>
        <when evaluator="header" expression="INBOUND:http.request.path=/jcore/insert/feed/">
            <component class="main.java.com.joshlabs.jcore.Feed"/>
        </when>
        <otherwise>
            <message-properties-transformer>
                <add-message-property key="http.status" value="404"/>
            </message-properties-transformer>
            <expression-transformer>
                <return-argument evaluator="string" expression="{Exception: &quot;Invalid URL&quot;}"/>
            </expression-transformer>
        </otherwise>
    </choice>
</flow>
constantlearner
  • 5,157
  • 7
  • 42
  • 64
  • Thanks fir the response, but I'm actually looking for how I can consume the webservice and see the output – philip Oct 22 '13 at 13:04
1

Your inbound endpoint is http://localhost:63081/hello which is the address you should call to consume your webservice.

Also your outbound endpoint seems to point to a address where there is no webservice to consume. Unless you have a second flow in your mule config that you do not show.

Pontus Ullgren
  • 697
  • 6
  • 24
  • Thanks, changed outbound endpoint to http://localhost:63081/hello, but still seeing the WSDL_XML on the browser, the same output as when Im building – philip Oct 22 '13 at 13:34
1

You've defined a flow which has a listener on service end-point http://localhost:63081/hello. In this flow request comes in and then it is forwarded using jaxws-client to another service listening at http://localhost:63081/services/greeter.

Now the error message says Cannot bind to address which means it cannot call the end-point. Is there a service running anywhere at the end-point you're trying to send request to? If you want to send request locally as look like from your flow, then you need another flow listening at that end-point similar to one you have but with different http-endpoint

Charu Khurana
  • 4,511
  • 8
  • 47
  • 81
  • Thanks for the answer, I created another flow with an inbound **http-endpoint** with address **http://localhost:63081/services/greeter** am I to embed **** or **** also – philip Oct 22 '13 at 15:01
  • `` as you're sending `soap` request using ``, so you need a server component to run a service – Charu Khurana Oct 22 '13 at 15:03
1

First issue: How can there be two services running on the same port (63081) on your localhost.

http://localhost:63081/hello
http://localhost:63081/services/greeter

Also As mentioned in your post, the web-service you have created is Hello service with the endpoint

http://localhost:63081/hello

So you web sevice should be as follows.

<flow name="helloService" doc:name="helloService">
   <http:inbound-endpoint address="http://localhost:63081/hello" exchange-pattern="request-response" doc:name="HTTP">
       <cxf:jaxws-service serviceClass="com.test.HelloWorld"/>
   </http:inbound-endpoint>
   <component class="com.test.HelloWorldImpl" doc:name="Java"/>
</flow>

In order to consume you can write another flow which has got the cxf:jaxws-client

<flow name="helloclient" >
  <some inbound endpoint. >
  ....
   <cxf:jaxws-client serviceClass="com.test.HelloWorld" operation="sayHi" doc:name="SOAP" />
   <outbound-endpoint address="http://localhost:63081/hello" doc:name="Generic"/>
  .....

</flow>

Hope this helps.

user1760178
  • 6,277
  • 5
  • 27
  • 57
  • Thanks, its not calling another service, what I want to simply achieve is building a service and consuming it, within the same host – philip Oct 22 '13 at 16:03
  • Then The hello service shold not have any other http outbound. One way to consume you webservice is via SOAP UI. Else. if you want to consume it via Mule then create another flow which has you JAXWS:Client making call to the hello service. – user1760178 Oct 22 '13 at 17:14