You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by BradS <jr...@mac.com> on 2007/12/08 05:56:02 UTC

Web service using HTTP/JSR181 services w/o a wsdl

I am trying to deploy a web service and I have it all configured, but my
service is not found when I invoke it.  My service is slightly different
then the wsdl-first example.  In that example there is an existing WSDL and
the classes are generated from that.  In my case, I have a web service impl
and I have defined the interface in java myself.  I can get the http su to
show me my web service in the deployed services list like this:

Error 404 - Not Found.

No service matched or handled this request.
Known services are:
http://10.0.1.2:8192/PersonService/
http://10.0.1.2:8192/SonicService/

But when I click on my SonicService WSDL I get resource not found.  My
question is how do I hook up the http consumer so it targets my jsr181
service properly, or is that even my problem?  I am having a hard time
figuring out how the messages generated by the http-su get targetted to the
jsr 181 service.

For reference, here are my two xbean files:

http-su:
<beans xmlns:http="http://servicemix.apache.org/http/1.0"
		xmlns:sonic="http://ws.sonic.com/Sonic">
	<http:endpoint
		service="sonic:SonicService"
		endpoint="soap"
		targetService="sonic:SonicService"
		role="consumer"
		locationURI="http://10.0.1.2:8192/SonicService/"
		defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
		soap="true"/>
</beans>

jsr181-su:
<beans xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
	   xmlns:ws-sonic-jsr181="urn:servicemix:ws-sonic-jsr181">
	<jsr181:endpoint pojoClass="com.sonic.ws.SonicImpl" />
</beans>

And here is the Sonic class:
@WebService(
	serviceName = "SonicService",
	targetNamespace = "http://ws.sonic.com/Sonic",
	endpointInterface = "com.sonic.ws.Sonic"
)
public interface Sonic {
	String echo(String message);
}

and finally my SonicImpl class:

public class SonicImpl implements Sonic {
	static {
		System.out.println("SonicImpl version 1.2");
	}

	public String echo(String message)
	{
		return "You said \"" + message + "\"";
	}
}

Some of the stuff, like the namespaces, service name and target service I
just made up because I don't know what they are.


-- 
View this message in context: http://www.nabble.com/Web-service-using-HTTP-JSR181-services-w-o-a-wsdl-tf4965955s12049.html#a14225502
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Web service using HTTP/JSR181 services w/o a wsdl

Posted by BradS <jr...@mac.com>.
By the way, this is the info I get in the debug log:

DEBUG - JettyContextManager            - Dispatching job:
SCEP@11721186[d=true,io=0,w=true,b=false|false]
DEBUG - ConsumerProcessor              - Receiving HTTP request: GET
/SonicService/main.wsdl HTTP/1.1
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-us)
AppleWebKit/523.10.3 (KHTML, like Gecko) Version/3.0.4 Safari/523.10
Cache-Control: max-age=0
Accept-Encoding: gzip, deflate
Referer: http://10.0.1.2:8192/
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us
Connection: keep-alive
Host: 10.0.1.2:8192


DEBUG - HttpComponent                  - Retrieving proxied endpoint
definition
DEBUG - HttpComponent                  - Could not retrieve endpoint for
service/endpoint
DEBUG - JettyContextManager            - Dispatching job:
SCEP@11721186[d=true,io=1,w=true,b=false|false]


-- 
View this message in context: http://www.nabble.com/Web-service-using-HTTP-JSR181-services-w-o-a-wsdl-tf4965955s12049.html#a14225634
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Web service using HTTP/JSR181 services w/o a wsdl

Posted by lhe77 <la...@compart.net>.
Hi BradS,

here is a working example I use: (only parts displayed)

http-su:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:http="http://servicemix.apache.org/http/1.0"
       xmlns:cp="http://www.compart.net/ns/jbi">

  <http:endpoint service="cp:ConversionService"
                 endpoint="SOAPService"
                 role="consumer"
                 locationURI="http://localhost:8192/processor/"
                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
                 soap="true" />

</beans>


jsr181-su:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0"
       xmlns:cp="http://www.compart.net/ns/jbi" >

    <jsr181:endpoint endpoint="ConversionService_1"
                     service="cp:ConversionService"
                     typeMapping="xmlbeans" >

                <jsr181:pojo>
                        <bean class="net.compart.jbi.ConversionService">
                        <property name="context" ref="context" />
                </bean>
                </jsr181:pojo>

  </jsr181:endpoint>

</beans>


the Java-class:

...
@WebService(name = "ConversionService", targetNamespace =
"http://localhost/ConversionService")
public class ConversionService
{
   ...
    private javax.jbi.component.ComponentContext context;

    public void setContext(javax.jbi.component.ComponentContext context)
        {
        this.context = context;
        }

    @WebMethod
    public byte[] processFile(byte[] input, String fileName)
    {
     ...
    }
  ...
}


Maybe this helps you on your way.

Regards,
Lars

-- 
View this message in context: http://www.nabble.com/Web-service-using-HTTP-JSR181-services-w-o-a-wsdl-tp14225502s12049p14249306.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.