Re: CXF 2.0.4 client sends SOAP request that server doesn't like

2008-03-02 Thread Michael Nelson
Never mind -- my build script wasn't properly rebuilding the client stub.

Thanks.

On 3/1/08, Michael Nelson [EMAIL PROTECTED] wrote:

 I am using CXF 2.0.4 on both client and server. I have a simple server
 interface derived from one of the samples (see below). When I try to call
 the deleteCustomer function using the CXF 2.0.4 wsdl2java client, the
 first element of the paramArray passed into
 org.apache.cxf.jaxws.JAXWSMethodInvoker.performInvocation() is null. If I
 use Microsoft's WCF, I don't have this problem.

 The difference between the two requests is the namespace prefix on the
 tags in the method invocation. If I remove them and do a manual post using
 wget, the call succeeds.

 WCF:
 s:Envelope xmlns:s=
 http://schemas.xmlsoap.org/soap/envelope/;s:BodydeleteCustomerhttp://schemas.xmlsoap.org/soap/envelope/%22%3E%3Cs:Body%3E%3CdeleteCustomer
 xmlns=
 http://customer.acme.com;id4300/id/deleteCustomer/s:Body/s:Envelope
 

 CXF client:

 soap:Envelope xmlns:soap=
 http://schemas.xmlsoap.org/soap/envelope/;soap:Bodyns2:deleteCustomerhttp://schemas.xmlsoap.org/soap/envelope/%22%3E%3Csoap:Body%3E%3Cns2:deleteCustomerxmlns:ns2=
 http://customer.acme.com;id4300/id/ns2:deleteCustomer/soap:Body/soap:Envelopes:Envelope
 xmlns:s=
 http://schemas.xmlsoap.org/soap/envelope/;s:BodydeleteCustomerid4300/id/deleteCustomer
 /s:Body/s:Envelope

 Any ideas on how I might be able to solve this problem? Or is this just a
 bug?

 Thanks,
 -mike

 ===

 @WebService(targetNamespace = http://customer.acme.com;)
 public interface CustomerService {
 [ ... Other methods ...]

@Delete
 @HttpResource(location = /customers/{id})
 void deleteCustomer(@WebParam(name = id)
 long id) throws CustomerNotFoundFault;

 }

 The client interface that is generated from wsdl2java is:

 @WebService(targetNamespace = http://customer.acme.com;, name =
 CustomerService)

 public interface CustomerService {
 [... Other methods ...]

 @RequestWrapper(localName = deleteCustomer, targetNamespace = 
 http://customer.acme.com;, className = com.acme.customer.DeleteCustomer)
 @ResponseWrapper(localName = deleteCustomerResponse, targetNamespace
 = http://customer.acme.com;, className = 
 com.acme.customer.DeleteCustomerResponse)
 @WebMethod
 public void deleteCustomer(
 @WebParam(name = id, targetNamespace = http://customer.acme.com
 )
 long id
 );
 };





CXF 2.0.4 client sends SOAP request that server doesn't like

2008-03-01 Thread Michael Nelson
I am using CXF 2.0.4 on both client and server. I have a simple server
interface derived from one of the samples (see below). When I try to call
the deleteCustomer function using the CXF 2.0.4 wsdl2java client, the
first element of the paramArray passed into
org.apache.cxf.jaxws.JAXWSMethodInvoker.performInvocation() is null. If I
use Microsoft's WCF, I don't have this problem.

The difference between the two requests is the namespace prefix on the tags
in the method invocation. If I remove them and do a manual post using wget,
the call succeeds.

WCF:
s:Envelope xmlns:s=
http://schemas.xmlsoap.org/soap/envelope/;s:BodydeleteCustomer
xmlns=
http://customer.acme.com;id4300/id/deleteCustomer/s:Body/s:Envelope


CXF client:

soap:Envelope xmlns:soap=
http://schemas.xmlsoap.org/soap/envelope/;soap:Bodyns2:deleteCustomerxmlns:ns2=
http://customer.acme.com;id4300/id/ns2:deleteCustomer/soap:Body/soap:Envelopes:Envelope
xmlns:s=
http://schemas.xmlsoap.org/soap/envelope/;s:BodydeleteCustomerid4300/id/deleteCustomer
/s:Body/s:Envelope

Any ideas on how I might be able to solve this problem? Or is this just a
bug?

Thanks,
-mike

===

@WebService(targetNamespace = http://customer.acme.com;)
public interface CustomerService {
[ ... Other methods ...]

   @Delete
@HttpResource(location = /customers/{id})
void deleteCustomer(@WebParam(name = id)
long id) throws CustomerNotFoundFault;

}

The client interface that is generated from wsdl2java is:

@WebService(targetNamespace = http://customer.acme.com;, name =
CustomerService)

public interface CustomerService {
[... Other methods ...]

@RequestWrapper(localName = deleteCustomer, targetNamespace = 
http://customer.acme.com;, className = com.acme.customer.DeleteCustomer)
@ResponseWrapper(localName = deleteCustomerResponse, targetNamespace =
http://customer.acme.com;, className = 
com.acme.customer.DeleteCustomerResponse)
@WebMethod
public void deleteCustomer(
@WebParam(name = id, targetNamespace = http://customer.acme.com;)
long id
);
};


request/response wrapper with wsdl2java

2008-03-01 Thread Michael Nelson
For non-trivial methods, WSDL2Java forces me to deal with request/response
wrapper classes in the client code it generates (see the 1st method as
compared to the 2nd method). Is there a way to prevent this?

Thanks,
-mike

Examples:

@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@WebResult(name = getCustomerResponse, targetNamespace = 
http://customer.acme.com;, partName = parameters)
@WebMethod
public com.acme.customer.GetCustomerResponse getCustomer(
@WebParam(partName = parameters, name = getCustomer,
targetNamespace = http://customer.acme.com;)
GetCustomer parameters
) throws CustomerNotFoundFault;

@RequestWrapper(localName = deleteCustomer2, targetNamespace = 
http://customer.acme.com;, className = com.acme.customer.DeleteCustomer2)
@ResponseWrapper(localName = deleteCustomer2Response, targetNamespace
= http://customer.acme.com;, className = 
com.acme.customer.DeleteCustomer2Response)
@WebMethod
public void deleteCustomer2(
@WebParam(name = id, targetNamespace = http://customer.acme.com;)
long id
);


Re: restful_http_binding and WebServiceContext

2007-12-01 Thread Michael Nelson
Cool. That did the trick. Thanks!

-mike

On Nov 25, 2007 5:55 PM, Willem Jiang [EMAIL PROTECTED] wrote:

 Hi Mike,

 I just checked the code , you need to specify the Service Bean object to
 be injected with the WebServiceContext.

 Here is an example for you:
  private static void createRestService(Object serviceObj) {
// Build up the server factory bean
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
sf.setServiceClass(CustomerService.class);
// Use the HTTP Binding which understands the Java Rest Annotations
sf.setBindingId(HttpBindingFactory.HTTP_BINDING_ID);
sf.setAddress(http://localhost:8080/xml/;);
// *** just set the service object as the service bean directly
 , to get the webservice context object to been injected.
sf.setServiceBean(serviceObj);

// Turn the wrapped style off. This means that CXF won't generate
// wrapper XML elements and we'll have prettier XML text. This
// means that we need to stick to one request and one response
// parameter though.
sf.getServiceFactory().setWrapped(false);

sf.create();
}

 Willem.

 Michael Nelson wrote:
  I am trying to figure out how to get access to WebServiceContext in the
  restful_http_binding sample that comes with CXF 2.0.3. In
  CustomerServiceImpl.java, I've added:
 
  @Resource
  private WebServiceContext wsContext;
 
  to the CustomerServiceImpl class.
 
  But wsContext isn't set when methods are invoked. I've looked through
 the
  archives and the only issue I've seen seems to be if you use Spring and
  transactions.
 
  I am new to CXF, so I may be doing something fundamentally wrong here.
 
  Any ideas?
 
  Thanks,
  -mike
 
 



restful_http_binding and WebServiceContext

2007-11-26 Thread Michael Nelson
I am trying to figure out how to get access to WebServiceContext in the
restful_http_binding sample that comes with CXF. In CustomerServiceImpl.java,
I've added:

@Resource
private WebServiceContext wsContext;

to the CustomerServiceImpl class.

But wsContext isn't set when methods are invoked. I've looked through the
archives and the only issue I've seen seems to be if you use Spring and
transactions (CXF-1074).

I am new to CXF, so I may be doing something fundamentally wrong here.

Any ideas?

Thanks,
-mike


restful_http_binding and WebServiceContext

2007-11-24 Thread Michael Nelson
I am trying to figure out how to get access to WebServiceContext in the
restful_http_binding sample that comes with CXF 2.0.3. In
CustomerServiceImpl.java, I've added:

@Resource
private WebServiceContext wsContext;

to the CustomerServiceImpl class.

But wsContext isn't set when methods are invoked. I've looked through the
archives and the only issue I've seen seems to be if you use Spring and
transactions.

I am new to CXF, so I may be doing something fundamentally wrong here.

Any ideas?

Thanks,
-mike