Question
· Apr 20

There's any way to edit a SOAP header?

Hello everyone, I need some help. 

I have to send some events for a government WebService that I already imported the WSDL and XSD's and It worked fine and I'm able to build the message and connect into the service, but It has been rejected with the message that the XML is wrong and the only diference between the Caché SOAP message to all the examples that the government gave us is the header:

   

This is how the Government is expecting the message:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
	<soap12:Body>
		<cteDadosMsg
			xmlns="http://www.portalfiscal.inf.br/cte/wsdl/CTeStatusServicoV4">
			-----------------Dynamic XML Body------------------
		</cteDadosMsg>
	</soap12:Body>
</soap12:Envelope>

 

And this is how It's generate in Cache:

  <  ?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope
           xmlns:SOAP-ENV='http://www.w3.org/2003/05/soap-envelope'
            xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
          xmlns:s='http://www.w3.org/2001/XMLSchema'>
          <SOAP-ENV:Body>
                     <cteDadosMsg
                              xmlns="http://www.portalfiscal.inf.br/cte/wsdl/CTeRecepcaoEventoV4">
                              -----------------Dynamic XML Body------------------ 
                     </cteDadosMsg>
         </SOAP-ENV:Body>
</SOAP-ENV:Envelope>  

 

 

So, there's any way to edit It before invoke the webMethod or any configuration that made it during the process?

Thank you so much!!

Product version: Ensemble 2018.1
Discussion (10)2
Log in or sign up to continue

I agree with you Enrico, to me It isn't the reason of the error, but I would like to try this change before waiting for a long time te answer of the government support that is really slow over here hehehe.

So, there is not a SOAP fault, the system only send a message like "malformed XML" as we forgot some tag or something else, but me and another analyst did a double check and is perfect as the documentation says.

 

Hello, Enrico, thank you so much for your time, I'm calling the WS directly from the class generated in the SOAP Wizard, we use Caché 2018.1 over here and I did a double check today in the documentation and found a parameter that solve my problem with the prefix.

If for any reason you need to change it, just set this parameter into the class generated by the SOAP Wizard.

Parameter SOAPPREFIX = "AnythingYouNeed"