cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "juan.velez" <juan.ve...@areva-td.com>
Subject Trouble with services having multiple methods/operations
Date Fri, 05 Sep 2008 21:31:22 GMT

I had understood that a SEI could have multiple methods and the correct
method is chosen according to the soap action found in the Request Header. I
am using a Java first approach but when I try two different requests, one
addresses for each method/operation, both are handled by the same method
operation (in this case exportCmiModelDataV2).

wsdl

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="ExportRequestService"
targetNamespace="http://www.areva.com/mmi/wsdl"
xmlns:ns1="http://www.areva.com/mmi/xml"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.areva.com/mmi/wsdl"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:types>
    <schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://www.areva.com/mmi/xml"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:mmi="http://www.areva.com/mmi/xml">
      <complexType name="ExportRequestType">
        <sequence>
          <element name="Application" type="string"/>
          <element name="Environment" type="string"/>
          <element name="FilePath" type="string"/>
          <element name="CSMRequestId" type="string"/>
        </sequence>
      </complexType>
      <element name="ExportRequest" type="mmi:ExportRequestType"/>
    </schema>
  </wsdl:types>
  <wsdl:message name="processExport">
    <wsdl:part element="ns1:ExportRequest" name="request"/>
  </wsdl:message>
  <wsdl:message name="processExportV2">
    <wsdl:part element="ns1:ExportRequest" name="request"/>
  </wsdl:message>
  <wsdl:portType name="ExportRequestPortType">
    <wsdl:operation name="processExport">
      <wsdl:input message="tns:processExport" name="processExport"/>
    </wsdl:operation>
    <wsdl:operation name="processExportV2">
      <wsdl:input message="tns:processExportV2" name="processExportV2"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="ExportRequestServiceSoapBinding"
type="tns:ExportRequestPortType">
    <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="processExport">
      <soap:operation soapAction="processExport" style="document"/>
      <wsdl:input name="processExport">
        <soap:body use="literal"/>
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="processExportV2">
      <soap:operation soapAction="processExportV2" style="document"/>
      <wsdl:input name="processExportV2">
        <soap:body use="literal"/>
      </wsdl:input>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="ExportRequestService">
    <wsdl:port binding="tns:ExportRequestServiceSoapBinding"
name="ExportRequestPort">
      <soap:address location="http://localhost:8080/mmi/services/export"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

service

package com.arevatd.mmi.business.services;

import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

import com.areva.mmi.xml.ExportRequestType;

@WebService(name="ExportRequestPortType",
            targetNamespace="http://www.areva.com/mmi/wsdl")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface CmiModelDataExportWs {
    /**
     * The actual operation for this web service: perform an export of CMI
Model Data
     * 
     * @param request The Request to export a e-terrasource export project 
     */
    @WebMethod(operationName = "processExport", action = "processExport")
    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    @Oneway()
    public void exportCmiModelData(
        @WebParam(targetNamespace = "http://www.areva.com/mmi/xml",
                  partName="request",
                  name = "ExportRequest")
        ExportRequestType request);
    
    @WebMethod(operationName = "processExportV2", action =
"processExportV2")
    @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
    @Oneway()
    public void exportCmiModelDataV2(
        @WebParam(targetNamespace = "http://www.areva.com/mmi/xml",
                  partName="request",
                  name = "ExportRequest")
        ExportRequestType request);
}

service impl

package com.arevatd.mmi.business.services.support;

import java.util.logging.Logger;

import javax.jws.WebService;
import javax.xml.namespace.QName;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFactory;
import javax.xml.soap.SOAPFault;
import javax.xml.ws.BindingType;
import javax.xml.ws.soap.SOAPFaultException;

import com.arevatd.mmi.business.services.CmiModelDataExportWs;

import com.areva.mmi.xml.ExportRequestType;


@WebService(endpointInterface="com.arevatd.mmi.business.services.CmiModelDataExportWs",
            name="ExportRequestPortType",
            portName="ExportRequestPort",
            serviceName="ExportRequestService",
            targetNamespace="http://www.areva.com/mmi/wsdl")
@BindingType(value=javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING)
public class CmiModelDataExportWsImpl implements CmiModelDataExportWs {
    private final Logger logger =
Logger.getLogger(this.getClass().getName());

    public void exportCmiModelData(ExportRequestType request) {
        logger.info("Application=" + request.getApplication());
        logger.info("Environment=" + request.getEnvironment());
        logger.info("FilePath=" + request.getFilePath());
        logger.info("CSMRequestId=" + request.getCSMRequestId());
        
        try {
            SOAPFactory soapFactory = SOAPFactory.newInstance();
            SOAPFault fault = soapFactory.createFault("Hello",
                new QName("http://schemas.xmlsoap.org/soap/envelope/",
"Client"));
            fault.setFaultString("Juan");

            throw new SOAPFaultException(fault);
        } catch(SOAPException se) {
        }
    }

    public void exportCmiModelDataV2(ExportRequestType request) {
        logger.info("V2Application=" + request.getApplication());
        logger.info("V2Environment=" + request.getEnvironment());
        logger.info("V2FilePath=" + request.getFilePath());
        logger.info("V2CSMRequestId=" + request.getCSMRequestId());
        
        try {
            SOAPFactory soapFactory = SOAPFactory.newInstance();
            SOAPFault fault = soapFactory.createFault("Hello",
                new QName("http://schemas.xmlsoap.org/soap/envelope/",
"Client"));
            fault.setFaultString("V2Juan");

            throw new SOAPFaultException(fault);
        } catch(SOAPException se) {
        }
    }
}

 request1 

Host: localhost:8080
Content-Length: 427
SOAPAction: "processExport"
User-Agent: Jakarta Commons-HttpClient/3.0.1
Content-Type: text/xml;charset=UTF-8

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://www.areva.com/mmi/xml">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:ExportRequest>
         <ns:Application>?</ns:Application>
         <ns:Environment>?</ns:Environment>
         <ns:FilePath>?</ns:FilePath>
         <ns:CSMRequestId>?</ns:CSMRequestId>
      </ns:ExportRequest>
   </soapenv:Body>
</soapenv:Envelope>

 request2 

Host: localhost:8080
Content-Length: 427
SOAPAction: "processExportV2"
User-Agent: Jakarta Commons-HttpClient/3.0.1
Content-Type: text/xml;charset=UTF-8

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://www.areva.com/mmi/xml">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:ExportRequest>
         <ns:Application>?</ns:Application>
         <ns:Environment>?</ns:Environment>
         <ns:FilePath>?</ns:FilePath>
         <ns:CSMRequestId>?</ns:CSMRequestId>
      </ns:ExportRequest>
   </soapenv:Body>
</soapenv:Envelope>
-- 
View this message in context: http://www.nabble.com/Trouble-with-services-having-multiple-methods-operations-tp19339853p19339853.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message