You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by IgnatiusReilly <el...@gmail.com> on 2015/03/09 15:35:51 UTC

CXF - Problem with generated WSDL

Hi,

I am having trouble with the CXF component.
I've developed a WebService using a code-first approach. The service works
as expected except for the answer it returns to the caller:

Message part BackgroundReports was not recognized. (Does it exist in service
WSDL?)

BackgroundReports is the class I used as an input for the WS. However it is
not present in the autogenerated WSDL.

Could someone please tell me how to set the appropriate annotations in order
to get it included in the WSDL?

Camel Version: 2.14

Brief of the route:


                Map<String, Object> props = new HashMap<String,Object>();
               
props.put(WSHandlerConstants.ACTION,WSHandlerConstants.USERNAME_TOKEN);
                props.put(WSHandlerConstants.PASSWORD_TYPE, passwordType);
                props.put(WSHandlerConstants.PW_CALLBACK_CLASS,
ServerPasswordCallback.class.getName());              
                WSS4JInInterceptor wssIn = new WSS4JInInterceptor(props);
                
                CxfEndpoint cxfEndpoint = new CxfEndpoint();
                cxfEndpoint.setServiceClass(serviceInterface.getClass());
                cxfEndpoint.setCamelContext(getContext());
                cxfEndpoint.setBindingId(httpBinding);
                cxfEndpoint.setDataFormat(dataFormat);
                cxfEndpoint.setAddress(path);
                cxfEndpoint.getInInterceptors().add(wssIn);         
                
                from(cxfEndpoint)

                .log(LoggingLevel.INFO, logName, "Request received:
${body}}")
                .process(new Processor(){
                    public void process(Exchange msg){
                        BackgroundReports report =
msg.getIn().getBody(BackgroundReports.class);
			...
			--- Custom Logic ---
			...
                    }
                })
                .choice()
                .when(result)
			...
			--- Custom Logic ---
			...

                    .process(new Processor(){
                        public void process(Exchange msg) {
                            ServiceResponse serviceResponse = new
ServiceResponse();
                            serviceResponse.setResult("Success");
                            msg.setProperty("Response",serviceResponse);
                            msg.getOut().setBody(serviceResponse);
                        }
                    })
                    .transform(simple("${property.Response}"))
                    .endChoice()
                .otherwise()
			...
			--- Custom Logic ---
			...

                    .setBody(simple("<body>Error</body>"))
                    .endChoice();

ServiceInterface:

@WebService
@SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE)
public interface ServiceInterface {
    @WebResult(name="serviceResponse")
   ServiceResponse
processResult(@WebParam(name="backgroundReports")BackgroundReports input);
}

ServiceResponse:

@XmlType(name="verifyResponse")
@XmlAccessorType(XmlAccessType.FIELD)
public class ServiceResponse {

    @XmlElement(name="result", required=true, nillable=false)
    protected String result;

    public String getResult() {
        return result;
    }

    public void setResult(String value) {
        this.result = value;
    }

    public String toString() {
        return this.getResult();
    }
}
Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/CXF-Problem-with-generated-WSDL-tp5763855.html
Sent from the Camel - Users mailing list archive at Nabble.com.