You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Paulo Goncalves (Jira)" <ji...@apache.org> on 2020/09/20 14:25:00 UTC

[jira] [Created] (CXF-8342) Tag with XML generate a invalid request

Paulo Goncalves created CXF-8342:
------------------------------------

             Summary: Tag with XML generate a invalid request
                 Key: CXF-8342
                 URL: https://issues.apache.org/jira/browse/CXF-8342
             Project: CXF
          Issue Type: Wish
            Reporter: Paulo Goncalves


Hello,

To replace an old service, i have to add a new webservice (server side) to an API REST micro service.

One of the requirements is to maintain the old request format.

{color:#FF0000}Problem{color}: (..simplifying..)
 One tag of the request is an xmlString that contains xml declaration in data like :
 <gen: name>*<?xml version="1"?><root>...</root>*</gen: name>

 

*Request*:
<soapenv: Envelope xmlns: soapenv = "http://schemas.xmlsoap.org/soap/envelope/" xmlns: gen = "http://www.baeldung.com/springsoap/gen">
 <soapenv: Header />
 <soapenv: Body>
 <gen: getCountryRequest>
 <gen: name>*<?xml version = "1" ?> <root> ... </root>*</ gen: name>
 </ gen: getCountryRequest>
 </ soapenv: Body>
</ soapenv: Envelope>


gen: name = "abcdef" works successfully


gen: name = *<? xml version = "1"?>* gives error:
2020-09-20 14: 30: 42.086 ERROR 16016 --- [nio-8080-exec-5] c.sun.xml.internal.messaging.saaj.soap: *SAAJ0511: Unable to create envelope from given source*
*ERROR: 'The processing instruction target matching "[xX] [mM] [lL]" is not allowed.'*



{color:#FF0000}Question{color}: +*Is it possible to inform the XJC code generator to accept XML data in requests ?*+


Thanks
Paulo

-----
POM

{{<! - generate server sources from xsd (soap) ->}}
{{<plugin>}}
{{<groupId>org.codehaus.mojo</groupId>}}
{{<artifactId>jaxb2-maven-plugin</artifactId>}}
{{<executions>}}
{{<execution>}}
{{<id>xjc</id>}}
{{<goals>}}
{{<goal>xjc</goal>}}
{{</goals>}}
{{</execution>}}
{{</executions>}}
{{<configuration>}}
{{<outputDirectory>${project.build.directory}/generated-sources-srv</outputDirectory>}}
{{<clearOutputDir>true</clearOutputDir>}}
{{<sources>}}
{{<source>${project.basedir} /src/main/resources/xsd/countries.xsd</source>}}
{{</sources>}}
{{</configuration>}}
{{</plugin>}}

----------------
Second try and same result:

{{<plugin>}}
{{ <groupId>org.apache.cxf</groupId>}}
{{ <artifactId>cxf-codegen-plugin</artifactId>}}
{{ <version>${cxf.version}</version>}}
{{ <executions>}}
{{ <execution>}}
{{ <id>generate-sources</id>}}
{{ <phase>generate-sources</phase>}}
{{ <configuration>}}
{{ <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>}}
{{ <wsdlOptions>}}
{{ <wsdlOption>}}
{{ <wsdl>${basedir}/src/main/resources/countries.wsdl</wsdl>}}
{{ </wsdlOption>}}
{{ </wsdlOptions>}}
{{ </configuration>}}
{{ <goals>}}
{{ <goal>wsdl2java</goal>}}
{{ </goals>}}
{{ </execution>}}
{{ </executions>}}
{{</plugin>}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)