• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to modify the return of the xml on a JWS.java file?  RSS feed

 
Joshua Rosa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am quite new on webservices, even though I know some basic concepts. I am experienced on Java though. I was tasked to do the following modification on an existing code that is inside a JWS.java file:

Currently on SOAPUI it is returning this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <m:clearedOrdersJWSResponse xmlns:m="open:services.com">
         <m:response>Success SO:1234</m:response>
      </m:clearedOrdersJWSResponse>
   </soapenv:Body>
</soapenv:Envelope>


However, I need to return this now, as part of the new spec:

<m:clearedOrdersJWSResponse xmlns:m="open:services.com">
<m:message>Sucess SO:1234</m:message>
<Code>
<m:ID>123</m:ID>
<m:Type>Installed</m:Type>
</Code>
<Code>
<m:ID>456</m:ID>
<m:Type>Uninstalled</m:Type>
<Code>


It is assumed I should return a DTO that contains the information above, but I don't exactly how to implement that, mainly because of the way xml is broken for code and type. No idea how to do that.

Bellow follows the source code snippet  for what it is returning now (EquipmentJWS.java):

@WebMethod(action = "open:clearedOrders")
@RolesAllowed({ @SecurityRole(role = "ACESS") })
@WebResult(name = "response")
public String clearedOrdersJWS(
@WebParam(name = "ClearedOrdersComplexType") ClearedOrdersDTO ClearedOrdersComplexType)  throws SOAPException {

MyService service = ....

try {

service.clearedOrders(ClearedOrdersComplexType, super.getServiceActor());

I see there are some xml files I should check as well, but I am not managing to navigate using them in order to know where I should modify them for the new spec.

Please let me know what kind of additional info I could provide if you are to help me to advance on this task. I am really stuck on this.

Thank you in advance.
 
Joshua Rosa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Additional info:

package com.myservices.home.webservices.moving;


I also found this file that may shed some light on which xml files I should modify (I am using Weblogic)
C:\bea\user_projects\domains\myDomain\servers\AdminServer\tmp\_WL_user\.MyServicesHomeWebServices\xxp6vk\war\WEB-INF\META-INF\schemas\schema-2.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="open:services.myservicos.com" elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import namespace="java:com.myservices.home.services.dto"/>
  <xs:element name="clearedOrdersJWS">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="ClearedOrdersComplexType" type="java:clearedOrdersDTO" xmlns:java="java:com.myservices.home.services.dto"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="clearedOrdersJWSResponse">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="response" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!