You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Haroldo de Oliveira Pinheiro (JIRA)" <ji...@apache.org> on 2011/07/12 15:25:00 UTC

[jira] [Created] (CXF-3652) Duplicate default namespace declaration - CXF is adding undesired markup to inline XML

Duplicate default namespace declaration - CXF is adding undesired markup to inline XML
--------------------------------------------------------------------------------------

                 Key: CXF-3652
                 URL: https://issues.apache.org/jira/browse/CXF-3652
             Project: CXF
          Issue Type: Bug
    Affects Versions: 2.2.10
         Environment: jdk1.6.0_24 Windows XP SP3
            Reporter: Haroldo de Oliveira Pinheiro


Basically, CXF is turning this:

<http://www.portalfiscal.inf.br/nfe" versao="2.00"> 

Into this:

<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">

Causing an "Duplicate default namespace declaration" exception.

This is my Spring configuration:

    <?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="http://www.springframework.org/schema/beans  
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context 
           http://www.springframework.org/schema/context/spring-context.xsd
           http://www.springframework.org/schema/tx 
           http://www.springframework.org/schema/tx/spring-tx.xsd
           http://cxf.apache.org/configuration/security
           http://cxf.apache.org/schemas/configuration/security.xsd
           http://cxf.apache.org/jaxws 
           http://cxf.apache.org/schemas/jaxws.xsd
           http://cxf.apache.org/transports/http/configuration
           http://cxf.apache.org/schemas/configuration/http-conf.xsd
           http://cxf.apache.org/core 
           http://cxf.apache.org/schemas/core.xsd">

	<jaxws:client id="nfeStatusServicoMGWebService"
		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
		<jaxws:inInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
			</bean>
		</jaxws:inInterceptors>
		<jaxws:outInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
			</bean>
		</jaxws:outInterceptors>
	</jaxws:client>


	<http:conduit
		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">

		<http:tlsClientParameters>
			<sec:keyManagers keyPassword="password">
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
			</sec:keyManagers>
			<sec:trustManagers>
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
			</sec:trustManagers>
			<sec:cipherSuitesFilter>
				<!-- these filters ensure that a ciphersuite with export-suitable or 
					null encryption is used, but exclude anonymous Diffie-Hellman key change 
					as this is vulnerable to man-in-the-middle attacks -->
				<sec:include>.*_EXPORT_.*</sec:include>
				<sec:include>.*_EXPORT1024_.*</sec:include>
				<sec:include>.*_WITH_DES_.*</sec:include>
				<sec:include>.*_WITH_NULL_.*</sec:include>
				<sec:exclude>.*_DH_anon_.*</sec:exclude>
			</sec:cipherSuitesFilter>
		</http:tlsClientParameters>
		<http:client AutoRedirect="true" Connection="Keep-Alive" />

	</http:conduit>

    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus> 
</beans>

And this is my test code:

    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations={"spring-context-cxf.xml"})
    public class NFeCXFTest {
	
	private static String XML_TESTE_STATUS =
		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
		"    <tpAmb>2</tpAmb>" +
		"    <cUF>31</cUF>" +
		"    <xServ>STATUS</xServ>" +
		"</consStatServ>";

	
	private NfeStatusServico2Soap12 statusServ;

	@Test
	public void commitNfeStatusServicoNF() {
		NfeCabecMsg cabec = new NfeCabecMsg();
		cabec.setCUF("31");
		cabec.setVersaoDados("2.00");
		
		NfeDadosMsg dados = new NfeDadosMsg();
        try {
	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
			DocumentBuilder db = dbf.newDocumentBuilder();
	        InputSource is = new InputSource();
	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
	        Document contentDoc = db.parse(is);
	        dados.getContent().add(contentDoc.getDocumentElement());
		} catch (ParserConfigurationException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (SAXException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (IOException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		}			
		
		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
		Object retVal = ret.getContent().iterator().next();
		System.out.println(retVal.getClass());
		System.out.println("***.***.***");

		try {
			Result stringResult = new StringResult();
			TransformerFactory tFactory = TransformerFactory.newInstance();
			Transformer transformer = tFactory.newTransformer();
			transformer.transform(new DOMSource((Node)retVal), stringResult);
			System.out.println("O retorno é: " + stringResult);
		} catch (TransformerException e) {
			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
		}
	}
	
	@Resource(name="nfeStatusServicoMGWebService")
	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
		this.statusServ = statusServ;
	}

    }


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CXF-3652) Duplicate default namespace declaration - CXF is adding undesired markup to inline XML

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp updated CXF-3652:
-----------------------------

    Fix Version/s: NeedMoreInfo



I think I'd need a full testcase.   I'm not able to reproduce this.

That said, in your parsing, you aren't turning on the namespace support so that MAY be affecting the DOM you are passing.

{code}
dbf.setNamespaceAware(true);
{code}

> Duplicate default namespace declaration - CXF is adding undesired markup to inline XML
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-3652
>                 URL: https://issues.apache.org/jira/browse/CXF-3652
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.10, 2.4.1
>         Environment: jdk1.6.0_24 Windows XP SP3
>            Reporter: Haroldo de Oliveira Pinheiro
>            Assignee: Daniel Kulp
>             Fix For: NeedMoreInfo
>
>
> Basically, CXF is turning this:
> {noformat}<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Into this:
> {noformat}<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Causing an "Duplicate default namespace declaration" exception.
> This is my Spring configuration:
> {noformat} 
>     <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
> 	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans  
>            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>            http://www.springframework.org/schema/context 
>            http://www.springframework.org/schema/context/spring-context.xsd
>            http://www.springframework.org/schema/tx 
>            http://www.springframework.org/schema/tx/spring-tx.xsd
>            http://cxf.apache.org/configuration/security
>            http://cxf.apache.org/schemas/configuration/security.xsd
>            http://cxf.apache.org/jaxws 
>            http://cxf.apache.org/schemas/jaxws.xsd
>            http://cxf.apache.org/transports/http/configuration
>            http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://cxf.apache.org/core 
>            http://cxf.apache.org/schemas/core.xsd">
> 	<jaxws:client id="nfeStatusServicoMGWebService"
> 		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
> 		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
> 		<jaxws:inInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
> 			</bean>
> 		</jaxws:inInterceptors>
> 		<jaxws:outInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
> 			</bean>
> 		</jaxws:outInterceptors>
> 	</jaxws:client>
> 	<http:conduit
> 		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">
> 		<http:tlsClientParameters>
> 			<sec:keyManagers keyPassword="password">
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
> 			</sec:keyManagers>
> 			<sec:trustManagers>
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
> 			</sec:trustManagers>
> 			<sec:cipherSuitesFilter>
> 				<!-- these filters ensure that a ciphersuite with export-suitable or 
> 					null encryption is used, but exclude anonymous Diffie-Hellman key change 
> 					as this is vulnerable to man-in-the-middle attacks -->
> 				<sec:include>.*_EXPORT_.*</sec:include>
> 				<sec:include>.*_EXPORT1024_.*</sec:include>
> 				<sec:include>.*_WITH_DES_.*</sec:include>
> 				<sec:include>.*_WITH_NULL_.*</sec:include>
> 				<sec:exclude>.*_DH_anon_.*</sec:exclude>
> 			</sec:cipherSuitesFilter>
> 		</http:tlsClientParameters>
> 		<http:client AutoRedirect="true" Connection="Keep-Alive" />
> 	</http:conduit>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging/>
>         </cxf:features>
>     </cxf:bus> 
> </beans>
> {noformat} 
> And this is my test code:
> {noformat} 
>     @RunWith(SpringJUnit4ClassRunner.class)
>     @ContextConfiguration(locations={"spring-context-cxf.xml"})
>     public class NFeCXFTest {
> 	
> 	private static String XML_TESTE_STATUS =
> 		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
> 		"    <tpAmb>2</tpAmb>" +
> 		"    <cUF>31</cUF>" +
> 		"    <xServ>STATUS</xServ>" +
> 		"</consStatServ>";
> 	
> 	private NfeStatusServico2Soap12 statusServ;
> 	@Test
> 	public void commitNfeStatusServicoNF() {
> 		NfeCabecMsg cabec = new NfeCabecMsg();
> 		cabec.setCUF("31");
> 		cabec.setVersaoDados("2.00");
> 		
> 		NfeDadosMsg dados = new NfeDadosMsg();
>         try {
> 	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> 			DocumentBuilder db = dbf.newDocumentBuilder();
> 	        InputSource is = new InputSource();
> 	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
> 	        Document contentDoc = db.parse(is);
> 	        dados.getContent().add(contentDoc.getDocumentElement());
> 		} catch (ParserConfigurationException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (SAXException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (IOException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		}			
> 		
> 		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
> 		Object retVal = ret.getContent().iterator().next();
> 		System.out.println(retVal.getClass());
> 		System.out.println("***.***.***");
> 		try {
> 			Result stringResult = new StringResult();
> 			TransformerFactory tFactory = TransformerFactory.newInstance();
> 			Transformer transformer = tFactory.newTransformer();
> 			transformer.transform(new DOMSource((Node)retVal), stringResult);
> 			System.out.println("O retorno é: " + stringResult);
> 		} catch (TransformerException e) {
> 			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
> 		}
> 	}
> 	
> 	@Resource(name="nfeStatusServicoMGWebService")
> 	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
> 		this.statusServ = statusServ;
> 	}
>     }
> {noformat} 
> ---
> Edit: I tried upgrading to 2.4.1 but, sorry, the error persists.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CXF-3652) Duplicate default namespace declaration - CXF is adding undesired markup to inline XML

Posted by "Haroldo de Oliveira Pinheiro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Haroldo de Oliveira Pinheiro updated CXF-3652:
----------------------------------------------

    Description: 
Basically, CXF is turning this:

<http://www.portalfiscal.inf.br/nfe" versao="2.00"> 

Into this:

<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">

Causing an "Duplicate default namespace declaration" exception.

This is my Spring configuration:

{noformat} 
    <?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="http://www.springframework.org/schema/beans  
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context 
           http://www.springframework.org/schema/context/spring-context.xsd
           http://www.springframework.org/schema/tx 
           http://www.springframework.org/schema/tx/spring-tx.xsd
           http://cxf.apache.org/configuration/security
           http://cxf.apache.org/schemas/configuration/security.xsd
           http://cxf.apache.org/jaxws 
           http://cxf.apache.org/schemas/jaxws.xsd
           http://cxf.apache.org/transports/http/configuration
           http://cxf.apache.org/schemas/configuration/http-conf.xsd
           http://cxf.apache.org/core 
           http://cxf.apache.org/schemas/core.xsd">

	<jaxws:client id="nfeStatusServicoMGWebService"
		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
		<jaxws:inInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
			</bean>
		</jaxws:inInterceptors>
		<jaxws:outInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
			</bean>
		</jaxws:outInterceptors>
	</jaxws:client>


	<http:conduit
		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">

		<http:tlsClientParameters>
			<sec:keyManagers keyPassword="password">
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
			</sec:keyManagers>
			<sec:trustManagers>
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
			</sec:trustManagers>
			<sec:cipherSuitesFilter>
				<!-- these filters ensure that a ciphersuite with export-suitable or 
					null encryption is used, but exclude anonymous Diffie-Hellman key change 
					as this is vulnerable to man-in-the-middle attacks -->
				<sec:include>.*_EXPORT_.*</sec:include>
				<sec:include>.*_EXPORT1024_.*</sec:include>
				<sec:include>.*_WITH_DES_.*</sec:include>
				<sec:include>.*_WITH_NULL_.*</sec:include>
				<sec:exclude>.*_DH_anon_.*</sec:exclude>
			</sec:cipherSuitesFilter>
		</http:tlsClientParameters>
		<http:client AutoRedirect="true" Connection="Keep-Alive" />

	</http:conduit>

    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus> 
</beans>
{noformat} 

And this is my test code:

{noformat} 
    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations={"spring-context-cxf.xml"})
    public class NFeCXFTest {
	
	private static String XML_TESTE_STATUS =
		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
		"    <tpAmb>2</tpAmb>" +
		"    <cUF>31</cUF>" +
		"    <xServ>STATUS</xServ>" +
		"</consStatServ>";

	
	private NfeStatusServico2Soap12 statusServ;

	@Test
	public void commitNfeStatusServicoNF() {
		NfeCabecMsg cabec = new NfeCabecMsg();
		cabec.setCUF("31");
		cabec.setVersaoDados("2.00");
		
		NfeDadosMsg dados = new NfeDadosMsg();
        try {
	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
			DocumentBuilder db = dbf.newDocumentBuilder();
	        InputSource is = new InputSource();
	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
	        Document contentDoc = db.parse(is);
	        dados.getContent().add(contentDoc.getDocumentElement());
		} catch (ParserConfigurationException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (SAXException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (IOException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		}			
		
		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
		Object retVal = ret.getContent().iterator().next();
		System.out.println(retVal.getClass());
		System.out.println("***.***.***");

		try {
			Result stringResult = new StringResult();
			TransformerFactory tFactory = TransformerFactory.newInstance();
			Transformer transformer = tFactory.newTransformer();
			transformer.transform(new DOMSource((Node)retVal), stringResult);
			System.out.println("O retorno é: " + stringResult);
		} catch (TransformerException e) {
			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
		}
	}
	
	@Resource(name="nfeStatusServicoMGWebService")
	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
		this.statusServ = statusServ;
	}

    }
{noformat} 

  was:
Basically, CXF is turning this:

<http://www.portalfiscal.inf.br/nfe" versao="2.00"> 

Into this:

<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">

Causing an "Duplicate default namespace declaration" exception.

This is my Spring configuration:

    <?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="http://www.springframework.org/schema/beans  
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context 
           http://www.springframework.org/schema/context/spring-context.xsd
           http://www.springframework.org/schema/tx 
           http://www.springframework.org/schema/tx/spring-tx.xsd
           http://cxf.apache.org/configuration/security
           http://cxf.apache.org/schemas/configuration/security.xsd
           http://cxf.apache.org/jaxws 
           http://cxf.apache.org/schemas/jaxws.xsd
           http://cxf.apache.org/transports/http/configuration
           http://cxf.apache.org/schemas/configuration/http-conf.xsd
           http://cxf.apache.org/core 
           http://cxf.apache.org/schemas/core.xsd">

	<jaxws:client id="nfeStatusServicoMGWebService"
		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
		<jaxws:inInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
			</bean>
		</jaxws:inInterceptors>
		<jaxws:outInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
			</bean>
		</jaxws:outInterceptors>
	</jaxws:client>


	<http:conduit
		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">

		<http:tlsClientParameters>
			<sec:keyManagers keyPassword="password">
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
			</sec:keyManagers>
			<sec:trustManagers>
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
			</sec:trustManagers>
			<sec:cipherSuitesFilter>
				<!-- these filters ensure that a ciphersuite with export-suitable or 
					null encryption is used, but exclude anonymous Diffie-Hellman key change 
					as this is vulnerable to man-in-the-middle attacks -->
				<sec:include>.*_EXPORT_.*</sec:include>
				<sec:include>.*_EXPORT1024_.*</sec:include>
				<sec:include>.*_WITH_DES_.*</sec:include>
				<sec:include>.*_WITH_NULL_.*</sec:include>
				<sec:exclude>.*_DH_anon_.*</sec:exclude>
			</sec:cipherSuitesFilter>
		</http:tlsClientParameters>
		<http:client AutoRedirect="true" Connection="Keep-Alive" />

	</http:conduit>

    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus> 
</beans>

And this is my test code:

    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations={"spring-context-cxf.xml"})
    public class NFeCXFTest {
	
	private static String XML_TESTE_STATUS =
		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
		"    <tpAmb>2</tpAmb>" +
		"    <cUF>31</cUF>" +
		"    <xServ>STATUS</xServ>" +
		"</consStatServ>";

	
	private NfeStatusServico2Soap12 statusServ;

	@Test
	public void commitNfeStatusServicoNF() {
		NfeCabecMsg cabec = new NfeCabecMsg();
		cabec.setCUF("31");
		cabec.setVersaoDados("2.00");
		
		NfeDadosMsg dados = new NfeDadosMsg();
        try {
	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
			DocumentBuilder db = dbf.newDocumentBuilder();
	        InputSource is = new InputSource();
	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
	        Document contentDoc = db.parse(is);
	        dados.getContent().add(contentDoc.getDocumentElement());
		} catch (ParserConfigurationException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (SAXException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (IOException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		}			
		
		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
		Object retVal = ret.getContent().iterator().next();
		System.out.println(retVal.getClass());
		System.out.println("***.***.***");

		try {
			Result stringResult = new StringResult();
			TransformerFactory tFactory = TransformerFactory.newInstance();
			Transformer transformer = tFactory.newTransformer();
			transformer.transform(new DOMSource((Node)retVal), stringResult);
			System.out.println("O retorno é: " + stringResult);
		} catch (TransformerException e) {
			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
		}
	}
	
	@Resource(name="nfeStatusServicoMGWebService")
	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
		this.statusServ = statusServ;
	}

    }



> Duplicate default namespace declaration - CXF is adding undesired markup to inline XML
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-3652
>                 URL: https://issues.apache.org/jira/browse/CXF-3652
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.10
>         Environment: jdk1.6.0_24 Windows XP SP3
>            Reporter: Haroldo de Oliveira Pinheiro
>
> Basically, CXF is turning this:
> <http://www.portalfiscal.inf.br/nfe" versao="2.00"> 
> Into this:
> <consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">
> Causing an "Duplicate default namespace declaration" exception.
> This is my Spring configuration:
> {noformat} 
>     <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
> 	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans  
>            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>            http://www.springframework.org/schema/context 
>            http://www.springframework.org/schema/context/spring-context.xsd
>            http://www.springframework.org/schema/tx 
>            http://www.springframework.org/schema/tx/spring-tx.xsd
>            http://cxf.apache.org/configuration/security
>            http://cxf.apache.org/schemas/configuration/security.xsd
>            http://cxf.apache.org/jaxws 
>            http://cxf.apache.org/schemas/jaxws.xsd
>            http://cxf.apache.org/transports/http/configuration
>            http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://cxf.apache.org/core 
>            http://cxf.apache.org/schemas/core.xsd">
> 	<jaxws:client id="nfeStatusServicoMGWebService"
> 		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
> 		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
> 		<jaxws:inInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
> 			</bean>
> 		</jaxws:inInterceptors>
> 		<jaxws:outInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
> 			</bean>
> 		</jaxws:outInterceptors>
> 	</jaxws:client>
> 	<http:conduit
> 		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">
> 		<http:tlsClientParameters>
> 			<sec:keyManagers keyPassword="password">
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
> 			</sec:keyManagers>
> 			<sec:trustManagers>
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
> 			</sec:trustManagers>
> 			<sec:cipherSuitesFilter>
> 				<!-- these filters ensure that a ciphersuite with export-suitable or 
> 					null encryption is used, but exclude anonymous Diffie-Hellman key change 
> 					as this is vulnerable to man-in-the-middle attacks -->
> 				<sec:include>.*_EXPORT_.*</sec:include>
> 				<sec:include>.*_EXPORT1024_.*</sec:include>
> 				<sec:include>.*_WITH_DES_.*</sec:include>
> 				<sec:include>.*_WITH_NULL_.*</sec:include>
> 				<sec:exclude>.*_DH_anon_.*</sec:exclude>
> 			</sec:cipherSuitesFilter>
> 		</http:tlsClientParameters>
> 		<http:client AutoRedirect="true" Connection="Keep-Alive" />
> 	</http:conduit>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging/>
>         </cxf:features>
>     </cxf:bus> 
> </beans>
> {noformat} 
> And this is my test code:
> {noformat} 
>     @RunWith(SpringJUnit4ClassRunner.class)
>     @ContextConfiguration(locations={"spring-context-cxf.xml"})
>     public class NFeCXFTest {
> 	
> 	private static String XML_TESTE_STATUS =
> 		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
> 		"    <tpAmb>2</tpAmb>" +
> 		"    <cUF>31</cUF>" +
> 		"    <xServ>STATUS</xServ>" +
> 		"</consStatServ>";
> 	
> 	private NfeStatusServico2Soap12 statusServ;
> 	@Test
> 	public void commitNfeStatusServicoNF() {
> 		NfeCabecMsg cabec = new NfeCabecMsg();
> 		cabec.setCUF("31");
> 		cabec.setVersaoDados("2.00");
> 		
> 		NfeDadosMsg dados = new NfeDadosMsg();
>         try {
> 	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> 			DocumentBuilder db = dbf.newDocumentBuilder();
> 	        InputSource is = new InputSource();
> 	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
> 	        Document contentDoc = db.parse(is);
> 	        dados.getContent().add(contentDoc.getDocumentElement());
> 		} catch (ParserConfigurationException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (SAXException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (IOException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		}			
> 		
> 		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
> 		Object retVal = ret.getContent().iterator().next();
> 		System.out.println(retVal.getClass());
> 		System.out.println("***.***.***");
> 		try {
> 			Result stringResult = new StringResult();
> 			TransformerFactory tFactory = TransformerFactory.newInstance();
> 			Transformer transformer = tFactory.newTransformer();
> 			transformer.transform(new DOMSource((Node)retVal), stringResult);
> 			System.out.println("O retorno é: " + stringResult);
> 		} catch (TransformerException e) {
> 			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
> 		}
> 	}
> 	
> 	@Resource(name="nfeStatusServicoMGWebService")
> 	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
> 		this.statusServ = statusServ;
> 	}
>     }
> {noformat} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Reopened] (CXF-3652) Duplicate default namespace declaration - CXF is adding undesired markup to inline XML

Posted by "Haroldo de Oliveira Pinheiro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Haroldo de Oliveira Pinheiro reopened CXF-3652:
-----------------------------------------------


Okay, I tried upgrading to 2.4.1 but, unfortunately, the error persists.
Is there something else that I need to update besides cxf-2.4.1.jar, cxf-manifest.jar, xmlschema-core-2.0.jar and neethi-3.0.0.jar?

> Duplicate default namespace declaration - CXF is adding undesired markup to inline XML
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-3652
>                 URL: https://issues.apache.org/jira/browse/CXF-3652
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.10, 2.4.1
>         Environment: jdk1.6.0_24 Windows XP SP3
>            Reporter: Haroldo de Oliveira Pinheiro
>            Assignee: Daniel Kulp
>
> Basically, CXF is turning this:
> {noformat}<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Into this:
> {noformat}<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Causing an "Duplicate default namespace declaration" exception.
> This is my Spring configuration:
> {noformat} 
>     <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
> 	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans  
>            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>            http://www.springframework.org/schema/context 
>            http://www.springframework.org/schema/context/spring-context.xsd
>            http://www.springframework.org/schema/tx 
>            http://www.springframework.org/schema/tx/spring-tx.xsd
>            http://cxf.apache.org/configuration/security
>            http://cxf.apache.org/schemas/configuration/security.xsd
>            http://cxf.apache.org/jaxws 
>            http://cxf.apache.org/schemas/jaxws.xsd
>            http://cxf.apache.org/transports/http/configuration
>            http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://cxf.apache.org/core 
>            http://cxf.apache.org/schemas/core.xsd">
> 	<jaxws:client id="nfeStatusServicoMGWebService"
> 		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
> 		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
> 		<jaxws:inInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
> 			</bean>
> 		</jaxws:inInterceptors>
> 		<jaxws:outInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
> 			</bean>
> 		</jaxws:outInterceptors>
> 	</jaxws:client>
> 	<http:conduit
> 		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">
> 		<http:tlsClientParameters>
> 			<sec:keyManagers keyPassword="password">
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
> 			</sec:keyManagers>
> 			<sec:trustManagers>
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
> 			</sec:trustManagers>
> 			<sec:cipherSuitesFilter>
> 				<!-- these filters ensure that a ciphersuite with export-suitable or 
> 					null encryption is used, but exclude anonymous Diffie-Hellman key change 
> 					as this is vulnerable to man-in-the-middle attacks -->
> 				<sec:include>.*_EXPORT_.*</sec:include>
> 				<sec:include>.*_EXPORT1024_.*</sec:include>
> 				<sec:include>.*_WITH_DES_.*</sec:include>
> 				<sec:include>.*_WITH_NULL_.*</sec:include>
> 				<sec:exclude>.*_DH_anon_.*</sec:exclude>
> 			</sec:cipherSuitesFilter>
> 		</http:tlsClientParameters>
> 		<http:client AutoRedirect="true" Connection="Keep-Alive" />
> 	</http:conduit>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging/>
>         </cxf:features>
>     </cxf:bus> 
> </beans>
> {noformat} 
> And this is my test code:
> {noformat} 
>     @RunWith(SpringJUnit4ClassRunner.class)
>     @ContextConfiguration(locations={"spring-context-cxf.xml"})
>     public class NFeCXFTest {
> 	
> 	private static String XML_TESTE_STATUS =
> 		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
> 		"    <tpAmb>2</tpAmb>" +
> 		"    <cUF>31</cUF>" +
> 		"    <xServ>STATUS</xServ>" +
> 		"</consStatServ>";
> 	
> 	private NfeStatusServico2Soap12 statusServ;
> 	@Test
> 	public void commitNfeStatusServicoNF() {
> 		NfeCabecMsg cabec = new NfeCabecMsg();
> 		cabec.setCUF("31");
> 		cabec.setVersaoDados("2.00");
> 		
> 		NfeDadosMsg dados = new NfeDadosMsg();
>         try {
> 	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> 			DocumentBuilder db = dbf.newDocumentBuilder();
> 	        InputSource is = new InputSource();
> 	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
> 	        Document contentDoc = db.parse(is);
> 	        dados.getContent().add(contentDoc.getDocumentElement());
> 		} catch (ParserConfigurationException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (SAXException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (IOException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		}			
> 		
> 		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
> 		Object retVal = ret.getContent().iterator().next();
> 		System.out.println(retVal.getClass());
> 		System.out.println("***.***.***");
> 		try {
> 			Result stringResult = new StringResult();
> 			TransformerFactory tFactory = TransformerFactory.newInstance();
> 			Transformer transformer = tFactory.newTransformer();
> 			transformer.transform(new DOMSource((Node)retVal), stringResult);
> 			System.out.println("O retorno é: " + stringResult);
> 		} catch (TransformerException e) {
> 			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
> 		}
> 	}
> 	
> 	@Resource(name="nfeStatusServicoMGWebService")
> 	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
> 		this.statusServ = statusServ;
> 	}
>     }
> {noformat} 
> ---
> Edit: I tried upgrading to 2.4.1 but, sorry, the error persists.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CXF-3652) Duplicate default namespace declaration - CXF is adding undesired markup to inline XML

Posted by "Haroldo de Oliveira Pinheiro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Haroldo de Oliveira Pinheiro updated CXF-3652:
----------------------------------------------

    Description: 
Basically, CXF is turning this:

{noformat}<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 

Into this:

{noformat}<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 

Causing an "Duplicate default namespace declaration" exception.

This is my Spring configuration:

{noformat} 
    <?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="http://www.springframework.org/schema/beans  
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context 
           http://www.springframework.org/schema/context/spring-context.xsd
           http://www.springframework.org/schema/tx 
           http://www.springframework.org/schema/tx/spring-tx.xsd
           http://cxf.apache.org/configuration/security
           http://cxf.apache.org/schemas/configuration/security.xsd
           http://cxf.apache.org/jaxws 
           http://cxf.apache.org/schemas/jaxws.xsd
           http://cxf.apache.org/transports/http/configuration
           http://cxf.apache.org/schemas/configuration/http-conf.xsd
           http://cxf.apache.org/core 
           http://cxf.apache.org/schemas/core.xsd">

	<jaxws:client id="nfeStatusServicoMGWebService"
		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
		<jaxws:inInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
			</bean>
		</jaxws:inInterceptors>
		<jaxws:outInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
			</bean>
		</jaxws:outInterceptors>
	</jaxws:client>


	<http:conduit
		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">

		<http:tlsClientParameters>
			<sec:keyManagers keyPassword="password">
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
			</sec:keyManagers>
			<sec:trustManagers>
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
			</sec:trustManagers>
			<sec:cipherSuitesFilter>
				<!-- these filters ensure that a ciphersuite with export-suitable or 
					null encryption is used, but exclude anonymous Diffie-Hellman key change 
					as this is vulnerable to man-in-the-middle attacks -->
				<sec:include>.*_EXPORT_.*</sec:include>
				<sec:include>.*_EXPORT1024_.*</sec:include>
				<sec:include>.*_WITH_DES_.*</sec:include>
				<sec:include>.*_WITH_NULL_.*</sec:include>
				<sec:exclude>.*_DH_anon_.*</sec:exclude>
			</sec:cipherSuitesFilter>
		</http:tlsClientParameters>
		<http:client AutoRedirect="true" Connection="Keep-Alive" />

	</http:conduit>

    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus> 
</beans>
{noformat} 

And this is my test code:

{noformat} 
    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations={"spring-context-cxf.xml"})
    public class NFeCXFTest {
	
	private static String XML_TESTE_STATUS =
		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
		"    <tpAmb>2</tpAmb>" +
		"    <cUF>31</cUF>" +
		"    <xServ>STATUS</xServ>" +
		"</consStatServ>";

	
	private NfeStatusServico2Soap12 statusServ;

	@Test
	public void commitNfeStatusServicoNF() {
		NfeCabecMsg cabec = new NfeCabecMsg();
		cabec.setCUF("31");
		cabec.setVersaoDados("2.00");
		
		NfeDadosMsg dados = new NfeDadosMsg();
        try {
	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
			DocumentBuilder db = dbf.newDocumentBuilder();
	        InputSource is = new InputSource();
	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
	        Document contentDoc = db.parse(is);
	        dados.getContent().add(contentDoc.getDocumentElement());
		} catch (ParserConfigurationException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (SAXException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (IOException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		}			
		
		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
		Object retVal = ret.getContent().iterator().next();
		System.out.println(retVal.getClass());
		System.out.println("***.***.***");

		try {
			Result stringResult = new StringResult();
			TransformerFactory tFactory = TransformerFactory.newInstance();
			Transformer transformer = tFactory.newTransformer();
			transformer.transform(new DOMSource((Node)retVal), stringResult);
			System.out.println("O retorno é: " + stringResult);
		} catch (TransformerException e) {
			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
		}
	}
	
	@Resource(name="nfeStatusServicoMGWebService")
	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
		this.statusServ = statusServ;
	}

    }
{noformat} 

  was:
Basically, CXF is turning this:

<http://www.portalfiscal.inf.br/nfe" versao="2.00"> 

Into this:

<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">

Causing an "Duplicate default namespace declaration" exception.

This is my Spring configuration:

{noformat} 
    <?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="http://www.springframework.org/schema/beans  
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context 
           http://www.springframework.org/schema/context/spring-context.xsd
           http://www.springframework.org/schema/tx 
           http://www.springframework.org/schema/tx/spring-tx.xsd
           http://cxf.apache.org/configuration/security
           http://cxf.apache.org/schemas/configuration/security.xsd
           http://cxf.apache.org/jaxws 
           http://cxf.apache.org/schemas/jaxws.xsd
           http://cxf.apache.org/transports/http/configuration
           http://cxf.apache.org/schemas/configuration/http-conf.xsd
           http://cxf.apache.org/core 
           http://cxf.apache.org/schemas/core.xsd">

	<jaxws:client id="nfeStatusServicoMGWebService"
		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
		<jaxws:inInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
			</bean>
		</jaxws:inInterceptors>
		<jaxws:outInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
			</bean>
		</jaxws:outInterceptors>
	</jaxws:client>


	<http:conduit
		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">

		<http:tlsClientParameters>
			<sec:keyManagers keyPassword="password">
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
			</sec:keyManagers>
			<sec:trustManagers>
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
			</sec:trustManagers>
			<sec:cipherSuitesFilter>
				<!-- these filters ensure that a ciphersuite with export-suitable or 
					null encryption is used, but exclude anonymous Diffie-Hellman key change 
					as this is vulnerable to man-in-the-middle attacks -->
				<sec:include>.*_EXPORT_.*</sec:include>
				<sec:include>.*_EXPORT1024_.*</sec:include>
				<sec:include>.*_WITH_DES_.*</sec:include>
				<sec:include>.*_WITH_NULL_.*</sec:include>
				<sec:exclude>.*_DH_anon_.*</sec:exclude>
			</sec:cipherSuitesFilter>
		</http:tlsClientParameters>
		<http:client AutoRedirect="true" Connection="Keep-Alive" />

	</http:conduit>

    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus> 
</beans>
{noformat} 

And this is my test code:

{noformat} 
    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations={"spring-context-cxf.xml"})
    public class NFeCXFTest {
	
	private static String XML_TESTE_STATUS =
		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
		"    <tpAmb>2</tpAmb>" +
		"    <cUF>31</cUF>" +
		"    <xServ>STATUS</xServ>" +
		"</consStatServ>";

	
	private NfeStatusServico2Soap12 statusServ;

	@Test
	public void commitNfeStatusServicoNF() {
		NfeCabecMsg cabec = new NfeCabecMsg();
		cabec.setCUF("31");
		cabec.setVersaoDados("2.00");
		
		NfeDadosMsg dados = new NfeDadosMsg();
        try {
	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
			DocumentBuilder db = dbf.newDocumentBuilder();
	        InputSource is = new InputSource();
	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
	        Document contentDoc = db.parse(is);
	        dados.getContent().add(contentDoc.getDocumentElement());
		} catch (ParserConfigurationException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (SAXException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (IOException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		}			
		
		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
		Object retVal = ret.getContent().iterator().next();
		System.out.println(retVal.getClass());
		System.out.println("***.***.***");

		try {
			Result stringResult = new StringResult();
			TransformerFactory tFactory = TransformerFactory.newInstance();
			Transformer transformer = tFactory.newTransformer();
			transformer.transform(new DOMSource((Node)retVal), stringResult);
			System.out.println("O retorno é: " + stringResult);
		} catch (TransformerException e) {
			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
		}
	}
	
	@Resource(name="nfeStatusServicoMGWebService")
	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
		this.statusServ = statusServ;
	}

    }
{noformat} 


> Duplicate default namespace declaration - CXF is adding undesired markup to inline XML
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-3652
>                 URL: https://issues.apache.org/jira/browse/CXF-3652
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.10
>         Environment: jdk1.6.0_24 Windows XP SP3
>            Reporter: Haroldo de Oliveira Pinheiro
>
> Basically, CXF is turning this:
> {noformat}<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Into this:
> {noformat}<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Causing an "Duplicate default namespace declaration" exception.
> This is my Spring configuration:
> {noformat} 
>     <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
> 	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans  
>            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>            http://www.springframework.org/schema/context 
>            http://www.springframework.org/schema/context/spring-context.xsd
>            http://www.springframework.org/schema/tx 
>            http://www.springframework.org/schema/tx/spring-tx.xsd
>            http://cxf.apache.org/configuration/security
>            http://cxf.apache.org/schemas/configuration/security.xsd
>            http://cxf.apache.org/jaxws 
>            http://cxf.apache.org/schemas/jaxws.xsd
>            http://cxf.apache.org/transports/http/configuration
>            http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://cxf.apache.org/core 
>            http://cxf.apache.org/schemas/core.xsd">
> 	<jaxws:client id="nfeStatusServicoMGWebService"
> 		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
> 		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
> 		<jaxws:inInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
> 			</bean>
> 		</jaxws:inInterceptors>
> 		<jaxws:outInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
> 			</bean>
> 		</jaxws:outInterceptors>
> 	</jaxws:client>
> 	<http:conduit
> 		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">
> 		<http:tlsClientParameters>
> 			<sec:keyManagers keyPassword="password">
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
> 			</sec:keyManagers>
> 			<sec:trustManagers>
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
> 			</sec:trustManagers>
> 			<sec:cipherSuitesFilter>
> 				<!-- these filters ensure that a ciphersuite with export-suitable or 
> 					null encryption is used, but exclude anonymous Diffie-Hellman key change 
> 					as this is vulnerable to man-in-the-middle attacks -->
> 				<sec:include>.*_EXPORT_.*</sec:include>
> 				<sec:include>.*_EXPORT1024_.*</sec:include>
> 				<sec:include>.*_WITH_DES_.*</sec:include>
> 				<sec:include>.*_WITH_NULL_.*</sec:include>
> 				<sec:exclude>.*_DH_anon_.*</sec:exclude>
> 			</sec:cipherSuitesFilter>
> 		</http:tlsClientParameters>
> 		<http:client AutoRedirect="true" Connection="Keep-Alive" />
> 	</http:conduit>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging/>
>         </cxf:features>
>     </cxf:bus> 
> </beans>
> {noformat} 
> And this is my test code:
> {noformat} 
>     @RunWith(SpringJUnit4ClassRunner.class)
>     @ContextConfiguration(locations={"spring-context-cxf.xml"})
>     public class NFeCXFTest {
> 	
> 	private static String XML_TESTE_STATUS =
> 		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
> 		"    <tpAmb>2</tpAmb>" +
> 		"    <cUF>31</cUF>" +
> 		"    <xServ>STATUS</xServ>" +
> 		"</consStatServ>";
> 	
> 	private NfeStatusServico2Soap12 statusServ;
> 	@Test
> 	public void commitNfeStatusServicoNF() {
> 		NfeCabecMsg cabec = new NfeCabecMsg();
> 		cabec.setCUF("31");
> 		cabec.setVersaoDados("2.00");
> 		
> 		NfeDadosMsg dados = new NfeDadosMsg();
>         try {
> 	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> 			DocumentBuilder db = dbf.newDocumentBuilder();
> 	        InputSource is = new InputSource();
> 	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
> 	        Document contentDoc = db.parse(is);
> 	        dados.getContent().add(contentDoc.getDocumentElement());
> 		} catch (ParserConfigurationException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (SAXException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (IOException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		}			
> 		
> 		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
> 		Object retVal = ret.getContent().iterator().next();
> 		System.out.println(retVal.getClass());
> 		System.out.println("***.***.***");
> 		try {
> 			Result stringResult = new StringResult();
> 			TransformerFactory tFactory = TransformerFactory.newInstance();
> 			Transformer transformer = tFactory.newTransformer();
> 			transformer.transform(new DOMSource((Node)retVal), stringResult);
> 			System.out.println("O retorno é: " + stringResult);
> 		} catch (TransformerException e) {
> 			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
> 		}
> 	}
> 	
> 	@Resource(name="nfeStatusServicoMGWebService")
> 	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
> 		this.statusServ = statusServ;
> 	}
>     }
> {noformat} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CXF-3652) Duplicate default namespace declaration - CXF is adding undesired markup to inline XML

Posted by "Haroldo de Oliveira Pinheiro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Haroldo de Oliveira Pinheiro updated CXF-3652:
----------------------------------------------

          Description: 
Basically, CXF is turning this:

{noformat}<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 

Into this:

{noformat}<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 

Causing an "Duplicate default namespace declaration" exception.

This is my Spring configuration:

{noformat} 
    <?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="http://www.springframework.org/schema/beans  
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context 
           http://www.springframework.org/schema/context/spring-context.xsd
           http://www.springframework.org/schema/tx 
           http://www.springframework.org/schema/tx/spring-tx.xsd
           http://cxf.apache.org/configuration/security
           http://cxf.apache.org/schemas/configuration/security.xsd
           http://cxf.apache.org/jaxws 
           http://cxf.apache.org/schemas/jaxws.xsd
           http://cxf.apache.org/transports/http/configuration
           http://cxf.apache.org/schemas/configuration/http-conf.xsd
           http://cxf.apache.org/core 
           http://cxf.apache.org/schemas/core.xsd">

	<jaxws:client id="nfeStatusServicoMGWebService"
		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
		<jaxws:inInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
			</bean>
		</jaxws:inInterceptors>
		<jaxws:outInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
			</bean>
		</jaxws:outInterceptors>
	</jaxws:client>


	<http:conduit
		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">

		<http:tlsClientParameters>
			<sec:keyManagers keyPassword="password">
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
			</sec:keyManagers>
			<sec:trustManagers>
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
			</sec:trustManagers>
			<sec:cipherSuitesFilter>
				<!-- these filters ensure that a ciphersuite with export-suitable or 
					null encryption is used, but exclude anonymous Diffie-Hellman key change 
					as this is vulnerable to man-in-the-middle attacks -->
				<sec:include>.*_EXPORT_.*</sec:include>
				<sec:include>.*_EXPORT1024_.*</sec:include>
				<sec:include>.*_WITH_DES_.*</sec:include>
				<sec:include>.*_WITH_NULL_.*</sec:include>
				<sec:exclude>.*_DH_anon_.*</sec:exclude>
			</sec:cipherSuitesFilter>
		</http:tlsClientParameters>
		<http:client AutoRedirect="true" Connection="Keep-Alive" />

	</http:conduit>

    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus> 
</beans>
{noformat} 

And this is my test code:

{noformat} 
    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations={"spring-context-cxf.xml"})
    public class NFeCXFTest {
	
	private static String XML_TESTE_STATUS =
		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
		"    <tpAmb>2</tpAmb>" +
		"    <cUF>31</cUF>" +
		"    <xServ>STATUS</xServ>" +
		"</consStatServ>";

	
	private NfeStatusServico2Soap12 statusServ;

	@Test
	public void commitNfeStatusServicoNF() {
		NfeCabecMsg cabec = new NfeCabecMsg();
		cabec.setCUF("31");
		cabec.setVersaoDados("2.00");
		
		NfeDadosMsg dados = new NfeDadosMsg();
        try {
	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
			DocumentBuilder db = dbf.newDocumentBuilder();
	        InputSource is = new InputSource();
	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
	        Document contentDoc = db.parse(is);
	        dados.getContent().add(contentDoc.getDocumentElement());
		} catch (ParserConfigurationException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (SAXException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (IOException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		}			
		
		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
		Object retVal = ret.getContent().iterator().next();
		System.out.println(retVal.getClass());
		System.out.println("***.***.***");

		try {
			Result stringResult = new StringResult();
			TransformerFactory tFactory = TransformerFactory.newInstance();
			Transformer transformer = tFactory.newTransformer();
			transformer.transform(new DOMSource((Node)retVal), stringResult);
			System.out.println("O retorno é: " + stringResult);
		} catch (TransformerException e) {
			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
		}
	}
	
	@Resource(name="nfeStatusServicoMGWebService")
	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
		this.statusServ = statusServ;
	}

    }
{noformat} 

---

Edit: I tried upgrading to 2.4.1 but, sorry, the error persists.

  was:
Basically, CXF is turning this:

{noformat}<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 

Into this:

{noformat}<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 

Causing an "Duplicate default namespace declaration" exception.

This is my Spring configuration:

{noformat} 
    <?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:cxf="http://cxf.apache.org/core"
	xsi:schemaLocation="http://www.springframework.org/schema/beans  
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context 
           http://www.springframework.org/schema/context/spring-context.xsd
           http://www.springframework.org/schema/tx 
           http://www.springframework.org/schema/tx/spring-tx.xsd
           http://cxf.apache.org/configuration/security
           http://cxf.apache.org/schemas/configuration/security.xsd
           http://cxf.apache.org/jaxws 
           http://cxf.apache.org/schemas/jaxws.xsd
           http://cxf.apache.org/transports/http/configuration
           http://cxf.apache.org/schemas/configuration/http-conf.xsd
           http://cxf.apache.org/core 
           http://cxf.apache.org/schemas/core.xsd">

	<jaxws:client id="nfeStatusServicoMGWebService"
		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
		<jaxws:inInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
			</bean>
		</jaxws:inInterceptors>
		<jaxws:outInterceptors>
			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
			</bean>
		</jaxws:outInterceptors>
	</jaxws:client>


	<http:conduit
		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">

		<http:tlsClientParameters>
			<sec:keyManagers keyPassword="password">
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
			</sec:keyManagers>
			<sec:trustManagers>
				<sec:keyStore type="JKS" password="123456"
					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
			</sec:trustManagers>
			<sec:cipherSuitesFilter>
				<!-- these filters ensure that a ciphersuite with export-suitable or 
					null encryption is used, but exclude anonymous Diffie-Hellman key change 
					as this is vulnerable to man-in-the-middle attacks -->
				<sec:include>.*_EXPORT_.*</sec:include>
				<sec:include>.*_EXPORT1024_.*</sec:include>
				<sec:include>.*_WITH_DES_.*</sec:include>
				<sec:include>.*_WITH_NULL_.*</sec:include>
				<sec:exclude>.*_DH_anon_.*</sec:exclude>
			</sec:cipherSuitesFilter>
		</http:tlsClientParameters>
		<http:client AutoRedirect="true" Connection="Keep-Alive" />

	</http:conduit>

    <cxf:bus>
        <cxf:features>
            <cxf:logging/>
        </cxf:features>
    </cxf:bus> 
</beans>
{noformat} 

And this is my test code:

{noformat} 
    @RunWith(SpringJUnit4ClassRunner.class)
    @ContextConfiguration(locations={"spring-context-cxf.xml"})
    public class NFeCXFTest {
	
	private static String XML_TESTE_STATUS =
		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
		"    <tpAmb>2</tpAmb>" +
		"    <cUF>31</cUF>" +
		"    <xServ>STATUS</xServ>" +
		"</consStatServ>";

	
	private NfeStatusServico2Soap12 statusServ;

	@Test
	public void commitNfeStatusServicoNF() {
		NfeCabecMsg cabec = new NfeCabecMsg();
		cabec.setCUF("31");
		cabec.setVersaoDados("2.00");
		
		NfeDadosMsg dados = new NfeDadosMsg();
        try {
	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
			DocumentBuilder db = dbf.newDocumentBuilder();
	        InputSource is = new InputSource();
	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
	        Document contentDoc = db.parse(is);
	        dados.getContent().add(contentDoc.getDocumentElement());
		} catch (ParserConfigurationException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (SAXException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		} catch (IOException e) {
			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
		}			
		
		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
		Object retVal = ret.getContent().iterator().next();
		System.out.println(retVal.getClass());
		System.out.println("***.***.***");

		try {
			Result stringResult = new StringResult();
			TransformerFactory tFactory = TransformerFactory.newInstance();
			Transformer transformer = tFactory.newTransformer();
			transformer.transform(new DOMSource((Node)retVal), stringResult);
			System.out.println("O retorno é: " + stringResult);
		} catch (TransformerException e) {
			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
		}
	}
	
	@Resource(name="nfeStatusServicoMGWebService")
	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
		this.statusServ = statusServ;
	}

    }
{noformat} 

    Affects Version/s: 2.4.1
        Fix Version/s:     (was: 2.4.1)

> Duplicate default namespace declaration - CXF is adding undesired markup to inline XML
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-3652
>                 URL: https://issues.apache.org/jira/browse/CXF-3652
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.10, 2.4.1
>         Environment: jdk1.6.0_24 Windows XP SP3
>            Reporter: Haroldo de Oliveira Pinheiro
>            Assignee: Daniel Kulp
>
> Basically, CXF is turning this:
> {noformat}<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Into this:
> {noformat}<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Causing an "Duplicate default namespace declaration" exception.
> This is my Spring configuration:
> {noformat} 
>     <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
> 	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans  
>            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>            http://www.springframework.org/schema/context 
>            http://www.springframework.org/schema/context/spring-context.xsd
>            http://www.springframework.org/schema/tx 
>            http://www.springframework.org/schema/tx/spring-tx.xsd
>            http://cxf.apache.org/configuration/security
>            http://cxf.apache.org/schemas/configuration/security.xsd
>            http://cxf.apache.org/jaxws 
>            http://cxf.apache.org/schemas/jaxws.xsd
>            http://cxf.apache.org/transports/http/configuration
>            http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://cxf.apache.org/core 
>            http://cxf.apache.org/schemas/core.xsd">
> 	<jaxws:client id="nfeStatusServicoMGWebService"
> 		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
> 		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
> 		<jaxws:inInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
> 			</bean>
> 		</jaxws:inInterceptors>
> 		<jaxws:outInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
> 			</bean>
> 		</jaxws:outInterceptors>
> 	</jaxws:client>
> 	<http:conduit
> 		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">
> 		<http:tlsClientParameters>
> 			<sec:keyManagers keyPassword="password">
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
> 			</sec:keyManagers>
> 			<sec:trustManagers>
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
> 			</sec:trustManagers>
> 			<sec:cipherSuitesFilter>
> 				<!-- these filters ensure that a ciphersuite with export-suitable or 
> 					null encryption is used, but exclude anonymous Diffie-Hellman key change 
> 					as this is vulnerable to man-in-the-middle attacks -->
> 				<sec:include>.*_EXPORT_.*</sec:include>
> 				<sec:include>.*_EXPORT1024_.*</sec:include>
> 				<sec:include>.*_WITH_DES_.*</sec:include>
> 				<sec:include>.*_WITH_NULL_.*</sec:include>
> 				<sec:exclude>.*_DH_anon_.*</sec:exclude>
> 			</sec:cipherSuitesFilter>
> 		</http:tlsClientParameters>
> 		<http:client AutoRedirect="true" Connection="Keep-Alive" />
> 	</http:conduit>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging/>
>         </cxf:features>
>     </cxf:bus> 
> </beans>
> {noformat} 
> And this is my test code:
> {noformat} 
>     @RunWith(SpringJUnit4ClassRunner.class)
>     @ContextConfiguration(locations={"spring-context-cxf.xml"})
>     public class NFeCXFTest {
> 	
> 	private static String XML_TESTE_STATUS =
> 		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
> 		"    <tpAmb>2</tpAmb>" +
> 		"    <cUF>31</cUF>" +
> 		"    <xServ>STATUS</xServ>" +
> 		"</consStatServ>";
> 	
> 	private NfeStatusServico2Soap12 statusServ;
> 	@Test
> 	public void commitNfeStatusServicoNF() {
> 		NfeCabecMsg cabec = new NfeCabecMsg();
> 		cabec.setCUF("31");
> 		cabec.setVersaoDados("2.00");
> 		
> 		NfeDadosMsg dados = new NfeDadosMsg();
>         try {
> 	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> 			DocumentBuilder db = dbf.newDocumentBuilder();
> 	        InputSource is = new InputSource();
> 	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
> 	        Document contentDoc = db.parse(is);
> 	        dados.getContent().add(contentDoc.getDocumentElement());
> 		} catch (ParserConfigurationException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (SAXException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (IOException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		}			
> 		
> 		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
> 		Object retVal = ret.getContent().iterator().next();
> 		System.out.println(retVal.getClass());
> 		System.out.println("***.***.***");
> 		try {
> 			Result stringResult = new StringResult();
> 			TransformerFactory tFactory = TransformerFactory.newInstance();
> 			Transformer transformer = tFactory.newTransformer();
> 			transformer.transform(new DOMSource((Node)retVal), stringResult);
> 			System.out.println("O retorno é: " + stringResult);
> 		} catch (TransformerException e) {
> 			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
> 		}
> 	}
> 	
> 	@Resource(name="nfeStatusServicoMGWebService")
> 	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
> 		this.statusServ = statusServ;
> 	}
>     }
> {noformat} 
> ---
> Edit: I tried upgrading to 2.4.1 but, sorry, the error persists.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (CXF-3652) Duplicate default namespace declaration - CXF is adding undesired markup to inline XML

Posted by "Haroldo de Oliveira Pinheiro (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Haroldo de Oliveira Pinheiro updated CXF-3652:
----------------------------------------------

    Comment: was deleted

(was: Okay, I tried upgrading to 2.4.1 but, unfortunately, the error persists.
Is there something else that I need to update besides cxf-2.4.1.jar, cxf-manifest.jar, xmlschema-core-2.0.jar and neethi-3.0.0.jar?)

> Duplicate default namespace declaration - CXF is adding undesired markup to inline XML
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-3652
>                 URL: https://issues.apache.org/jira/browse/CXF-3652
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.10, 2.4.1
>         Environment: jdk1.6.0_24 Windows XP SP3
>            Reporter: Haroldo de Oliveira Pinheiro
>            Assignee: Daniel Kulp
>
> Basically, CXF is turning this:
> {noformat}<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Into this:
> {noformat}<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Causing an "Duplicate default namespace declaration" exception.
> This is my Spring configuration:
> {noformat} 
>     <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
> 	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans  
>            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>            http://www.springframework.org/schema/context 
>            http://www.springframework.org/schema/context/spring-context.xsd
>            http://www.springframework.org/schema/tx 
>            http://www.springframework.org/schema/tx/spring-tx.xsd
>            http://cxf.apache.org/configuration/security
>            http://cxf.apache.org/schemas/configuration/security.xsd
>            http://cxf.apache.org/jaxws 
>            http://cxf.apache.org/schemas/jaxws.xsd
>            http://cxf.apache.org/transports/http/configuration
>            http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://cxf.apache.org/core 
>            http://cxf.apache.org/schemas/core.xsd">
> 	<jaxws:client id="nfeStatusServicoMGWebService"
> 		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
> 		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
> 		<jaxws:inInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
> 			</bean>
> 		</jaxws:inInterceptors>
> 		<jaxws:outInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
> 			</bean>
> 		</jaxws:outInterceptors>
> 	</jaxws:client>
> 	<http:conduit
> 		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">
> 		<http:tlsClientParameters>
> 			<sec:keyManagers keyPassword="password">
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
> 			</sec:keyManagers>
> 			<sec:trustManagers>
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
> 			</sec:trustManagers>
> 			<sec:cipherSuitesFilter>
> 				<!-- these filters ensure that a ciphersuite with export-suitable or 
> 					null encryption is used, but exclude anonymous Diffie-Hellman key change 
> 					as this is vulnerable to man-in-the-middle attacks -->
> 				<sec:include>.*_EXPORT_.*</sec:include>
> 				<sec:include>.*_EXPORT1024_.*</sec:include>
> 				<sec:include>.*_WITH_DES_.*</sec:include>
> 				<sec:include>.*_WITH_NULL_.*</sec:include>
> 				<sec:exclude>.*_DH_anon_.*</sec:exclude>
> 			</sec:cipherSuitesFilter>
> 		</http:tlsClientParameters>
> 		<http:client AutoRedirect="true" Connection="Keep-Alive" />
> 	</http:conduit>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging/>
>         </cxf:features>
>     </cxf:bus> 
> </beans>
> {noformat} 
> And this is my test code:
> {noformat} 
>     @RunWith(SpringJUnit4ClassRunner.class)
>     @ContextConfiguration(locations={"spring-context-cxf.xml"})
>     public class NFeCXFTest {
> 	
> 	private static String XML_TESTE_STATUS =
> 		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
> 		"    <tpAmb>2</tpAmb>" +
> 		"    <cUF>31</cUF>" +
> 		"    <xServ>STATUS</xServ>" +
> 		"</consStatServ>";
> 	
> 	private NfeStatusServico2Soap12 statusServ;
> 	@Test
> 	public void commitNfeStatusServicoNF() {
> 		NfeCabecMsg cabec = new NfeCabecMsg();
> 		cabec.setCUF("31");
> 		cabec.setVersaoDados("2.00");
> 		
> 		NfeDadosMsg dados = new NfeDadosMsg();
>         try {
> 	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> 			DocumentBuilder db = dbf.newDocumentBuilder();
> 	        InputSource is = new InputSource();
> 	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
> 	        Document contentDoc = db.parse(is);
> 	        dados.getContent().add(contentDoc.getDocumentElement());
> 		} catch (ParserConfigurationException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (SAXException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (IOException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		}			
> 		
> 		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
> 		Object retVal = ret.getContent().iterator().next();
> 		System.out.println(retVal.getClass());
> 		System.out.println("***.***.***");
> 		try {
> 			Result stringResult = new StringResult();
> 			TransformerFactory tFactory = TransformerFactory.newInstance();
> 			Transformer transformer = tFactory.newTransformer();
> 			transformer.transform(new DOMSource((Node)retVal), stringResult);
> 			System.out.println("O retorno é: " + stringResult);
> 		} catch (TransformerException e) {
> 			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
> 		}
> 	}
> 	
> 	@Resource(name="nfeStatusServicoMGWebService")
> 	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
> 		this.statusServ = statusServ;
> 	}
>     }
> {noformat} 
> ---
> Edit: I tried upgrading to 2.4.1 but, sorry, the error persists.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Resolved] (CXF-3652) Duplicate default namespace declaration - CXF is adding undesired markup to inline XML

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-3652.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.4.1
         Assignee: Daniel Kulp


This was fixed a long time ago.   Please update to a more recent version of CXF.

> Duplicate default namespace declaration - CXF is adding undesired markup to inline XML
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-3652
>                 URL: https://issues.apache.org/jira/browse/CXF-3652
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.10
>         Environment: jdk1.6.0_24 Windows XP SP3
>            Reporter: Haroldo de Oliveira Pinheiro
>            Assignee: Daniel Kulp
>             Fix For: 2.4.1
>
>
> Basically, CXF is turning this:
> {noformat}<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Into this:
> {noformat}<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Causing an "Duplicate default namespace declaration" exception.
> This is my Spring configuration:
> {noformat} 
>     <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
> 	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans  
>            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>            http://www.springframework.org/schema/context 
>            http://www.springframework.org/schema/context/spring-context.xsd
>            http://www.springframework.org/schema/tx 
>            http://www.springframework.org/schema/tx/spring-tx.xsd
>            http://cxf.apache.org/configuration/security
>            http://cxf.apache.org/schemas/configuration/security.xsd
>            http://cxf.apache.org/jaxws 
>            http://cxf.apache.org/schemas/jaxws.xsd
>            http://cxf.apache.org/transports/http/configuration
>            http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://cxf.apache.org/core 
>            http://cxf.apache.org/schemas/core.xsd">
> 	<jaxws:client id="nfeStatusServicoMGWebService"
> 		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
> 		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
> 		<jaxws:inInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
> 			</bean>
> 		</jaxws:inInterceptors>
> 		<jaxws:outInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
> 			</bean>
> 		</jaxws:outInterceptors>
> 	</jaxws:client>
> 	<http:conduit
> 		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">
> 		<http:tlsClientParameters>
> 			<sec:keyManagers keyPassword="password">
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
> 			</sec:keyManagers>
> 			<sec:trustManagers>
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
> 			</sec:trustManagers>
> 			<sec:cipherSuitesFilter>
> 				<!-- these filters ensure that a ciphersuite with export-suitable or 
> 					null encryption is used, but exclude anonymous Diffie-Hellman key change 
> 					as this is vulnerable to man-in-the-middle attacks -->
> 				<sec:include>.*_EXPORT_.*</sec:include>
> 				<sec:include>.*_EXPORT1024_.*</sec:include>
> 				<sec:include>.*_WITH_DES_.*</sec:include>
> 				<sec:include>.*_WITH_NULL_.*</sec:include>
> 				<sec:exclude>.*_DH_anon_.*</sec:exclude>
> 			</sec:cipherSuitesFilter>
> 		</http:tlsClientParameters>
> 		<http:client AutoRedirect="true" Connection="Keep-Alive" />
> 	</http:conduit>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging/>
>         </cxf:features>
>     </cxf:bus> 
> </beans>
> {noformat} 
> And this is my test code:
> {noformat} 
>     @RunWith(SpringJUnit4ClassRunner.class)
>     @ContextConfiguration(locations={"spring-context-cxf.xml"})
>     public class NFeCXFTest {
> 	
> 	private static String XML_TESTE_STATUS =
> 		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
> 		"    <tpAmb>2</tpAmb>" +
> 		"    <cUF>31</cUF>" +
> 		"    <xServ>STATUS</xServ>" +
> 		"</consStatServ>";
> 	
> 	private NfeStatusServico2Soap12 statusServ;
> 	@Test
> 	public void commitNfeStatusServicoNF() {
> 		NfeCabecMsg cabec = new NfeCabecMsg();
> 		cabec.setCUF("31");
> 		cabec.setVersaoDados("2.00");
> 		
> 		NfeDadosMsg dados = new NfeDadosMsg();
>         try {
> 	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> 			DocumentBuilder db = dbf.newDocumentBuilder();
> 	        InputSource is = new InputSource();
> 	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
> 	        Document contentDoc = db.parse(is);
> 	        dados.getContent().add(contentDoc.getDocumentElement());
> 		} catch (ParserConfigurationException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (SAXException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (IOException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		}			
> 		
> 		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
> 		Object retVal = ret.getContent().iterator().next();
> 		System.out.println(retVal.getClass());
> 		System.out.println("***.***.***");
> 		try {
> 			Result stringResult = new StringResult();
> 			TransformerFactory tFactory = TransformerFactory.newInstance();
> 			Transformer transformer = tFactory.newTransformer();
> 			transformer.transform(new DOMSource((Node)retVal), stringResult);
> 			System.out.println("O retorno é: " + stringResult);
> 		} catch (TransformerException e) {
> 			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
> 		}
> 	}
> 	
> 	@Resource(name="nfeStatusServicoMGWebService")
> 	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
> 		this.statusServ = statusServ;
> 	}
>     }
> {noformat} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (CXF-3652) Duplicate default namespace declaration - CXF is adding undesired markup to inline XML

Posted by "Haroldo de Oliveira Pinheiro (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13063931#comment-13063931 ] 

Haroldo de Oliveira Pinheiro commented on CXF-3652:
---------------------------------------------------

Okay, I tried upgrading to 2.4.1 but, unfortunately, the error persists.
Is there something else that I need to update besides cxf-2.4.1.jar, cxf-manifest.jar, xmlschema-core-2.0.jar and neethi-3.0.0.jar?

> Duplicate default namespace declaration - CXF is adding undesired markup to inline XML
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-3652
>                 URL: https://issues.apache.org/jira/browse/CXF-3652
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.10, 2.4.1
>         Environment: jdk1.6.0_24 Windows XP SP3
>            Reporter: Haroldo de Oliveira Pinheiro
>            Assignee: Daniel Kulp
>
> Basically, CXF is turning this:
> {noformat}<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Into this:
> {noformat}<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Causing an "Duplicate default namespace declaration" exception.
> This is my Spring configuration:
> {noformat} 
>     <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
> 	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans  
>            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>            http://www.springframework.org/schema/context 
>            http://www.springframework.org/schema/context/spring-context.xsd
>            http://www.springframework.org/schema/tx 
>            http://www.springframework.org/schema/tx/spring-tx.xsd
>            http://cxf.apache.org/configuration/security
>            http://cxf.apache.org/schemas/configuration/security.xsd
>            http://cxf.apache.org/jaxws 
>            http://cxf.apache.org/schemas/jaxws.xsd
>            http://cxf.apache.org/transports/http/configuration
>            http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://cxf.apache.org/core 
>            http://cxf.apache.org/schemas/core.xsd">
> 	<jaxws:client id="nfeStatusServicoMGWebService"
> 		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
> 		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
> 		<jaxws:inInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
> 			</bean>
> 		</jaxws:inInterceptors>
> 		<jaxws:outInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
> 			</bean>
> 		</jaxws:outInterceptors>
> 	</jaxws:client>
> 	<http:conduit
> 		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">
> 		<http:tlsClientParameters>
> 			<sec:keyManagers keyPassword="password">
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
> 			</sec:keyManagers>
> 			<sec:trustManagers>
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
> 			</sec:trustManagers>
> 			<sec:cipherSuitesFilter>
> 				<!-- these filters ensure that a ciphersuite with export-suitable or 
> 					null encryption is used, but exclude anonymous Diffie-Hellman key change 
> 					as this is vulnerable to man-in-the-middle attacks -->
> 				<sec:include>.*_EXPORT_.*</sec:include>
> 				<sec:include>.*_EXPORT1024_.*</sec:include>
> 				<sec:include>.*_WITH_DES_.*</sec:include>
> 				<sec:include>.*_WITH_NULL_.*</sec:include>
> 				<sec:exclude>.*_DH_anon_.*</sec:exclude>
> 			</sec:cipherSuitesFilter>
> 		</http:tlsClientParameters>
> 		<http:client AutoRedirect="true" Connection="Keep-Alive" />
> 	</http:conduit>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging/>
>         </cxf:features>
>     </cxf:bus> 
> </beans>
> {noformat} 
> And this is my test code:
> {noformat} 
>     @RunWith(SpringJUnit4ClassRunner.class)
>     @ContextConfiguration(locations={"spring-context-cxf.xml"})
>     public class NFeCXFTest {
> 	
> 	private static String XML_TESTE_STATUS =
> 		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
> 		"    <tpAmb>2</tpAmb>" +
> 		"    <cUF>31</cUF>" +
> 		"    <xServ>STATUS</xServ>" +
> 		"</consStatServ>";
> 	
> 	private NfeStatusServico2Soap12 statusServ;
> 	@Test
> 	public void commitNfeStatusServicoNF() {
> 		NfeCabecMsg cabec = new NfeCabecMsg();
> 		cabec.setCUF("31");
> 		cabec.setVersaoDados("2.00");
> 		
> 		NfeDadosMsg dados = new NfeDadosMsg();
>         try {
> 	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> 			DocumentBuilder db = dbf.newDocumentBuilder();
> 	        InputSource is = new InputSource();
> 	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
> 	        Document contentDoc = db.parse(is);
> 	        dados.getContent().add(contentDoc.getDocumentElement());
> 		} catch (ParserConfigurationException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (SAXException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (IOException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		}			
> 		
> 		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
> 		Object retVal = ret.getContent().iterator().next();
> 		System.out.println(retVal.getClass());
> 		System.out.println("***.***.***");
> 		try {
> 			Result stringResult = new StringResult();
> 			TransformerFactory tFactory = TransformerFactory.newInstance();
> 			Transformer transformer = tFactory.newTransformer();
> 			transformer.transform(new DOMSource((Node)retVal), stringResult);
> 			System.out.println("O retorno é: " + stringResult);
> 		} catch (TransformerException e) {
> 			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
> 		}
> 	}
> 	
> 	@Resource(name="nfeStatusServicoMGWebService")
> 	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
> 		this.statusServ = statusServ;
> 	}
>     }
> {noformat} 
> ---
> Edit: I tried upgrading to 2.4.1 but, sorry, the error persists.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Resolved] (CXF-3652) Duplicate default namespace declaration - CXF is adding undesired markup to inline XML

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-3652?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-3652.
------------------------------

       Resolution: Cannot Reproduce
    Fix Version/s:     (was: NeedMoreInfo)
                   Invalid


Could not reproduce and request for testcase unanswered for more than a month.

> Duplicate default namespace declaration - CXF is adding undesired markup to inline XML
> --------------------------------------------------------------------------------------
>
>                 Key: CXF-3652
>                 URL: https://issues.apache.org/jira/browse/CXF-3652
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.2.10, 2.4.1
>         Environment: jdk1.6.0_24 Windows XP SP3
>            Reporter: Haroldo de Oliveira Pinheiro
>            Assignee: Daniel Kulp
>             Fix For: Invalid
>
>
> Basically, CXF is turning this:
> {noformat}<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Into this:
> {noformat}<consStatServ xmlns:ns2="http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2" xmlns="" xmlns="" xmlns:ns5="http://www.portalfiscal.inf.br/nfe" versao="2.00">{noformat} 
> Causing an "Duplicate default namespace declaration" exception.
> This is my Spring configuration:
> {noformat} 
>     <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
> 	xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration"
> 	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
> 	xmlns:cxf="http://cxf.apache.org/core"
> 	xsi:schemaLocation="http://www.springframework.org/schema/beans  
>            http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>            http://www.springframework.org/schema/context 
>            http://www.springframework.org/schema/context/spring-context.xsd
>            http://www.springframework.org/schema/tx 
>            http://www.springframework.org/schema/tx/spring-tx.xsd
>            http://cxf.apache.org/configuration/security
>            http://cxf.apache.org/schemas/configuration/security.xsd
>            http://cxf.apache.org/jaxws 
>            http://cxf.apache.org/schemas/jaxws.xsd
>            http://cxf.apache.org/transports/http/configuration
>            http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://cxf.apache.org/core 
>            http://cxf.apache.org/schemas/core.xsd">
> 	<jaxws:client id="nfeStatusServicoMGWebService"
> 		serviceClass="com.ats.nfe.webservice.mg.NfeStatusServico2Soap12"
> 		address="https://hnfe.fazenda.mg.gov.br/nfe2/services/NfeStatus2">
> 		<jaxws:inInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor">
> 			</bean>
> 		</jaxws:inInterceptors>
> 		<jaxws:outInterceptors>
> 			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor">
> 			</bean>
> 		</jaxws:outInterceptors>
> 	</jaxws:client>
> 	<http:conduit
> 		name="{http://www.portalfiscal.inf.br/nfe/wsdl/NfeStatusServico2}NfeStatusServico2Soap12Port.http-conduit">
> 		<http:tlsClientParameters>
> 			<sec:keyManagers keyPassword="password">
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/teste.jks" />
> 			</sec:keyManagers>
> 			<sec:trustManagers>
> 				<sec:keyStore type="JKS" password="123456"
> 					file="C:/Documents and Settings/HaroldoOliveira/truststore_nfe.jks" />
> 			</sec:trustManagers>
> 			<sec:cipherSuitesFilter>
> 				<!-- these filters ensure that a ciphersuite with export-suitable or 
> 					null encryption is used, but exclude anonymous Diffie-Hellman key change 
> 					as this is vulnerable to man-in-the-middle attacks -->
> 				<sec:include>.*_EXPORT_.*</sec:include>
> 				<sec:include>.*_EXPORT1024_.*</sec:include>
> 				<sec:include>.*_WITH_DES_.*</sec:include>
> 				<sec:include>.*_WITH_NULL_.*</sec:include>
> 				<sec:exclude>.*_DH_anon_.*</sec:exclude>
> 			</sec:cipherSuitesFilter>
> 		</http:tlsClientParameters>
> 		<http:client AutoRedirect="true" Connection="Keep-Alive" />
> 	</http:conduit>
>     <cxf:bus>
>         <cxf:features>
>             <cxf:logging/>
>         </cxf:features>
>     </cxf:bus> 
> </beans>
> {noformat} 
> And this is my test code:
> {noformat} 
>     @RunWith(SpringJUnit4ClassRunner.class)
>     @ContextConfiguration(locations={"spring-context-cxf.xml"})
>     public class NFeCXFTest {
> 	
> 	private static String XML_TESTE_STATUS =
> 		"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"2.00\">" +
> 		"    <tpAmb>2</tpAmb>" +
> 		"    <cUF>31</cUF>" +
> 		"    <xServ>STATUS</xServ>" +
> 		"</consStatServ>";
> 	
> 	private NfeStatusServico2Soap12 statusServ;
> 	@Test
> 	public void commitNfeStatusServicoNF() {
> 		NfeCabecMsg cabec = new NfeCabecMsg();
> 		cabec.setCUF("31");
> 		cabec.setVersaoDados("2.00");
> 		
> 		NfeDadosMsg dados = new NfeDadosMsg();
>         try {
> 	        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> 			DocumentBuilder db = dbf.newDocumentBuilder();
> 	        InputSource is = new InputSource();
> 	        is.setCharacterStream(new StringReader(XML_TESTE_STATUS));
> 	        Document contentDoc = db.parse(is);
> 	        dados.getContent().add(contentDoc.getDocumentElement());
> 		} catch (ParserConfigurationException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (SAXException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		} catch (IOException e) {
> 			throw new IllegalArgumentException("Erro ao empacotar o conteúdo, ", e);
> 		}			
> 		
> 		NfeStatusServicoNF2Result ret = this.statusServ.nfeStatusServicoNF2(dados, cabec);
> 		Object retVal = ret.getContent().iterator().next();
> 		System.out.println(retVal.getClass());
> 		System.out.println("***.***.***");
> 		try {
> 			Result stringResult = new StringResult();
> 			TransformerFactory tFactory = TransformerFactory.newInstance();
> 			Transformer transformer = tFactory.newTransformer();
> 			transformer.transform(new DOMSource((Node)retVal), stringResult);
> 			System.out.println("O retorno é: " + stringResult);
> 		} catch (TransformerException e) {
> 			throw new IllegalArgumentException("Impossível gerar nova requisição, ", e);
> 		}
> 	}
> 	
> 	@Resource(name="nfeStatusServicoMGWebService")
> 	public void setStatusServ(NfeStatusServico2Soap12 statusServ) {
> 		this.statusServ = statusServ;
> 	}
>     }
> {noformat} 
> ---
> Edit: I tried upgrading to 2.4.1 but, sorry, the error persists.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira