You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kandula-dev@ws.apache.org by "gonuguntla (JIRA)" <ji...@apache.org> on 2010/07/14 06:57:49 UTC

[jira] Created: (AXIS2-4778) Unable to get custom soap faultCode

Unable to get custom soap faultCode
-----------------------------------

                 Key: AXIS2-4778
                 URL: https://issues.apache.org/jira/browse/AXIS2-4778
             Project: Axis2
          Issue Type: Bug
    Affects Versions: 1.3
         Environment: axis2_1_3
            Reporter: gonuguntla


Hi ,
I want to throw custom SOAP faultCode rather than soapenv:Server.

			MessageContext inMessageContext = MessageContext.getCurrentMessageContext();

			SOAPFactory soapFactory = OMAbstractFactory.getSOAP11Factory();
			SOAPFault soapFault = soapFactory.createSOAPFault();

			SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode();
			soapFaultCode.setText(new QName("http://emp.org", "ESP_EMP_DATA_001", "e"));

			SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason();
			soapFaultReason.setText(new QName("http://emp.org", "Invalid Id", "e"));

			SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail();
			QName qName = new QName("http://emp.org", "EmpException", "ex");
			OMElement exception = soapFactory.createOMElement(qName, soapFaultDetail);
			exception.setText("Please enter valid employee details.");

			soapFault.setCode(soapFaultCode);
			soapFault.setReason(soapFaultReason);
			soapFault.setDetail(soapFaultDetail);

			inMessageContext.setProperty(SOAP11Constants.SOAP_FAULT_CODE_LOCAL_NAME, soapFaultCode);
			inMessageContext.setProperty(SOAP11Constants.SOAP_FAULT_STRING_LOCAL_NAME, soapFaultReason);
			inMessageContext.setProperty(SOAP11Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, soapFaultDetail);

			throw new AxisFault(soapFault);

Iam getting following SOAPResponse:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode xmlns:e="http://emp.org">soapenv:Server</faultcode>
         <faultstring xmlns:e="http://emp.org">e:Invalid Id</faultstring>
         <detail>
            <ex:EmpException xmlns:ex="http://emp.org">Please enter valid employee details.</ex:EmpException>
         </detail>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

Not getting custom soap Fault code: e.ESP_EMP_DATA_001 .
Iam using axis2_1_3 libraries for deployment.
Please let me know the resolution for this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org