[
https://issues.apache.org/jira/browse/CXF-2027?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12674768#action_12674768
]
[email protected] edited comment on CXF-2027 at 2/18/09 12:43 PM:
--------------------------------------------------------------------
If you want specific output it is probably better to define a schema and wsdl
by hand and create code from it. So you have more control over the result.
Btw. Your desired outpout is not possible. XML schema allows only one root
element and you want to return a list. What you could achieve is:
<userlist>
<User></User>
</userlist>
was (Author: [email protected]):
If you want specific output it is probably better to define a schema and
wsdl by hand and create code from it. So you have more control over the result.
> Problem in getting CXF output in particular format
> --------------------------------------------------
>
> Key: CXF-2027
> URL: https://issues.apache.org/jira/browse/CXF-2027
> Project: CXF
> Issue Type: Improvement
> Components: Configuration, Core, JAX-WS Runtime
> Environment: Jboss,Spring Framework,CXF
> Reporter: kishore
> Priority: Critical
> Original Estimate: 4h
> Remaining Estimate: 4h
>
> Hi ,
> Im having a problem in Output
> Sources:
> public class User
> {
> @XmlAttribute
> private int id;
>
> @XmlElement(name='Email')
> private String name;
>
> @XmlAttribute
> private String email;
>
> @XmlElemnt(Marks)
> private Marks marks;
> }
> public class Marks
> {
> @XmlAttribute
> private int id;
> @XmlAttribute
> private String aggregate;
> @XmlElemnt(Total)
> private String totalMarks;
> }
> Service:
> import javax.jws.WebService;
> import javax.xml.bind.annotation.XmlAccessType;
> import javax.xml.bind.annotation.XmlAccessorType;
> import javax.xml.bind.annotation.XmlElement;
> import javax.xml.bind.annotation.XmlType;
> import org.codehaus.jra.Get;
> import org.codehaus.jra.HttpResource;
> @WebService()
> public interface SampleService {
> @Get
> @HttpResource(location="/details")
>
> public List<User> getUserDetailsWithMarks();
> }
> ServiceImpl:
> import java.util.List;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.soap.SOAPBinding.ParameterStyle;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding.Use;
> public class SampleServiceImpl implements SampleService {
> @Override
> public List<User> getUserDetailsWithMarks() {
>
> User user=new User();
> user.setId(1000);
> user.setName("ONE");
> user.setEmail("[email protected]");
> Marks marks=new Marks();
> marks.setAggregate("77%");
> marks.setId(999);
> marks.setTotalMarks("1777");
> user.setMarks(marks);
> }
> }
> Configuration:
> <bean id="sampleService"
> class="SampleServiceImpl">
>
> </bean>
> <jaxws:endpoint id="sampleServiceID"
> implementor="#sampleService"
> address="/SampleService"
> bindingUri="http://apache.org/cxf/binding/http">
> <jaxws:serviceFactory>
> <bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
> <property name="wrapped" value="true" />
> </bean>
> </jaxws:serviceFactory>
>
> </jaxws:endpoint>
> Im Getting output like this
> <ns1:getUserDetailsWithMarksResponse>
> <ns1:User id="1000" email='[email protected]'>
> <name>ONE</name>
> <ns1:Marks id="999" aggregate="77%">
> <Total>77/100</total>
> </ns1:Marks>
> </ns1:User>
> </ns1:getUserDetailsWithMarksResponse>
> But i need output like this :
> <User id="1000" email="[email protected]">
> <name>ONE</name>
> <Marks id='999' aggregate="77%">1777</Marks>
> </User>
>
>
>
>
>
>
>
>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.