You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Freeman Yue Fang (Jira)" <ji...@apache.org> on 2020/11/04 19:36:00 UTC

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

    [ https://issues.apache.org/jira/browse/CXF-8342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17226363#comment-17226363 ] 

Freeman Yue Fang commented on CXF-8342:
---------------------------------------

Hi [~paulomfgoncalves],

I believe you can use CDATA tag to achieve such thing. You may want to take a look at [this discussion|https://stackoverflow.com/questions/2784183/what-does-cdata-in-xml-mean] to get more detailed ideas.

Btw, jira should be used for bug/new feature/enhancement. Questions like this should go to cxf-dev mailling list for discussion.

Best Regards
Freeman

> 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
>            Priority: Minor
>
> 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)