Groups > Weblogic > WebLogic Webservices > complex type return.




complex type return.

complex type return.
Sun, 18 Nov 2007 15:48:47 -080
Hi guys;
   I have this simple class

//This class is implemented as webservice which return complex type of World.

public class HelloWorld {

	public World sayHelloWorld(World world,String countryCode) {
		if(new World().isValidWorld(world))return world;
		else return null;		
	}	
}


public class World {

	private String world1 = "us";
	private String world2 = "uk";

	public boolean isValidWorld(World world){
		System.out.println("client passed: world1 "+world.getWorld1()+"
world2: "+world.getWorld2());
		if(world.getWorld1().equalsIgnoreCase(this.getWorld1()) &&
world.getWorld2().equalsIgnoreCase(this.getWorld2()))return true;
		else
			return false;
	}
	//getter and setter for world1 and world2
}


Now in weblogic test page.I have 
parameter as world ,type as World and value as follows:

<world  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:n1="java:com.util"
  xsi:type="n1:World">
 <world1   href="#ID_2">
 </world1>
 <world2   href="#ID_2">
 </world2>
 <xsd:string   xsi:type="xsd:string"
   id="ID_2">sample string</xsd:string>
</world>

and for next i have parameter as string,type as string and value as text box to
input.

But i don't understand or don't know why there is only one input value to put
ie. <xsd:string   xsi:type="xsd:string"
   id="ID_2">sample string</xsd:string> .there should be 2 to
input world1 and world2.and now if i input value abc instead of sample string it
will pass 
   the same value(abc) for both world1 and world2 to server.Is that i did sth.
wrong in build or there is more.I shall appreciate if somebody
   has answer onto this.Basically for complex type i need like this
automatically..

<world  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:n1="java:com.util"
  xsi:type="n1:World">
 <world1   href="#ID_1">
 </world1>
 <world2   href="#ID_2">
 </world2>
 <xsd:string   xsi:type="xsd:string"
   id="ID_1">sample string</xsd:string>
 <xsd:string   xsi:type="xsd:string"
   id="ID_2">sample string</xsd:string>
</world>

Post Reply
about | contact