You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by pi...@gmail.com on 2009/04/08 18:10:13 UTC

WebService client : connecting to the server without WSDL access ?

Hi everyone,

I'm in trouble using cxf.

I'm looking for a way to send a request from a client, which cannot see the
wsdL;
first, is that possible ?

In fact, i've developped a service using wsdl2java, but the client will not
be able to see the wsdl (security rules..)

So, I don't know how to make the code work, and how to get a port to send my
requests.


for informations, here is the way a get a port, when I hava access to my
wsdl :

my service :

@WebServiceClient(name = "Service",
                  wsdlLocation = "wsdl/theWSDL.wsdl",
                  targetNamespace = "http://target.com")

public class A64A extends Service {

    public final static URL WSDL_LOCATION;
    public final static QName SERVICE = new QName("http://target.com",
"Service");
    public final static QName A64APort = new QName("http://target.com",
"ServicePort");
    static {
        URL url = null;
        try {
                 url = new URL("wsdl/theWSDL.wsdl");
             } catch (MalformedURLException e) {
                  System.err.println("Can not initialize the default wsdl");
                  // e.printStackTrace();
        }
        WSDL_LOCATION = url;
    }

    public Service(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

...
}


how I get my port :

    Service ss = new Service (Service .WSDL_LOCATION, Service .SERVICE);
    Service Port port = ss.getServicePort();



Is there a way to explain that I whant to connect to some endpoint, but
where I will not be able to see the wsdl ?


hope you can help me, hope this is understandable.

thx struts users !

Re: WebService client : connecting to the server without WSDL access ?

Posted by Daniel Kulp <dk...@apache.org>.
Couple thoughts:

1) you could copy the wsdl locally, maybe even bundle it into the client jar, 
and just use it that way.   You can override the URL it's going to hit at 
runtime via:

((BindingProvider)port).getRequestContext().put(
   BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
   "http://blah.blah/blah");

2) You can do:
        Service service = Service.create(servName);
        service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
                             "http://blah.blah/blah");
        ServicePort port = service.getPort(portName,
                                                             ServicePort.class);

Dan




On Wed April 8 2009 12:10:13 pm piebetz@gmail.com wrote:
> Hi everyone,
>
> I'm in trouble using cxf.
>
> I'm looking for a way to send a request from a client, which cannot see the
> wsdL;
> first, is that possible ?
>
> In fact, i've developped a service using wsdl2java, but the client will not
> be able to see the wsdl (security rules..)
>
> So, I don't know how to make the code work, and how to get a port to send
> my requests.
>
>
> for informations, here is the way a get a port, when I hava access to my
> wsdl :
>
> my service :
>
> @WebServiceClient(name = "Service",
>                   wsdlLocation = "wsdl/theWSDL.wsdl",
>                   targetNamespace = "http://target.com")
>
> public class A64A extends Service {
>
>     public final static URL WSDL_LOCATION;
>     public final static QName SERVICE = new QName("http://target.com",
> "Service");
>     public final static QName A64APort = new QName("http://target.com",
> "ServicePort");
>     static {
>         URL url = null;
>         try {
>                  url = new URL("wsdl/theWSDL.wsdl");
>              } catch (MalformedURLException e) {
>                   System.err.println("Can not initialize the default
> wsdl"); // e.printStackTrace();
>         }
>         WSDL_LOCATION = url;
>     }
>
>     public Service(URL wsdlLocation, QName serviceName) {
>         super(wsdlLocation, serviceName);
>     }
>
> ...
> }
>
>
> how I get my port :
>
>     Service ss = new Service (Service .WSDL_LOCATION, Service .SERVICE);
>     Service Port port = ss.getServicePort();
>
>
>
> Is there a way to explain that I whant to connect to some endpoint, but
> where I will not be able to see the wsdl ?
>
>
> hope you can help me, hope this is understandable.
>
> thx struts users !

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

RE: WebService client : connecting to the server without WSDL access ?

Posted by John Hite <jh...@appsecinc.com>.
I think you are looking for JaxWsProxyFactoryBean. Take a look at the bottom of this page.

http://cwiki.apache.org/CXF20DOC/a-simple-jax-ws-service.html

-John

-----Original Message-----
From: piebetz@gmail.com [mailto:piebetz@gmail.com] 
Sent: Wednesday, April 08, 2009 12:10 PM
To: users@cxf.apache.org
Subject: WebService client : connecting to the server without WSDL access ?

Hi everyone,

I'm in trouble using cxf.

I'm looking for a way to send a request from a client, which cannot see the
wsdL;
first, is that possible ?

In fact, i've developped a service using wsdl2java, but the client will not
be able to see the wsdl (security rules..)

So, I don't know how to make the code work, and how to get a port to send my
requests.


for informations, here is the way a get a port, when I hava access to my
wsdl :

my service :

@WebServiceClient(name = "Service",
                  wsdlLocation = "wsdl/theWSDL.wsdl",
                  targetNamespace = "http://target.com")

public class A64A extends Service {

    public final static URL WSDL_LOCATION;
    public final static QName SERVICE = new QName("http://target.com",
"Service");
    public final static QName A64APort = new QName("http://target.com",
"ServicePort");
    static {
        URL url = null;
        try {
                 url = new URL("wsdl/theWSDL.wsdl");
             } catch (MalformedURLException e) {
                  System.err.println("Can not initialize the default wsdl");
                  // e.printStackTrace();
        }
        WSDL_LOCATION = url;
    }

    public Service(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

...
}


how I get my port :

    Service ss = new Service (Service .WSDL_LOCATION, Service .SERVICE);
    Service Port port = ss.getServicePort();



Is there a way to explain that I whant to connect to some endpoint, but
where I will not be able to see the wsdl ?


hope you can help me, hope this is understandable.

thx struts users !