The complex data type and java.lang.IllegalStateException

From: zhanglin <>
Date: Wed, 22 Jun 2005 17:28:42 +0800

I wrote a web service HelloWorld, and the WS had a method named sayHello(NewClass nc) where NewClass is a type I defined by myself. I defined the class according to the JavaBeans rules, and it has a private String member called value with a pair of getValue() and setValue(String s) methods.

I used the wscompile command to generated the static stub classes and wrote a Java application as the client of the HelloWorld web service. And I also newd a NewClass instance and invoked its setValue method. But when I called the web service, passed the NewClass instance as a parameter and print the result to the monitor, I do got the result I expected which accompanied with an exception. The output message is bellow:

2005-6-22 17:05:49 com.sun.xml.messaging.saaj.soap.impl.ElementImpl getValueNode Strict
严重: SAAJ0107: 无法在不具有类型文本的唯一子类型的元素中设置值
java.lang.IllegalStateException at com.sun.xml.messaging.saaj.soap.impl.ElementImpl.getValueNodeStrict( at com.sun.xml.messaging.saaj.soap.impl.ElementImpl.setValue( at hello.ClientHandler.handleRequest(
 at com.sun.xml.rpc.client.HandlerChainImpl.handleRequest(HandlerChainImp
 at com.sun.xml.rpc.client.StreamingSender._callRequestHandlers(Streaming
at com.sun.xml.rpc.client.StreamingSender._preRequestSendingHook(Streami
 at com.sun.xml.rpc.client.StreamingSender._send(
        at hello.HelloWorldSEI_Stub.sayHello(
        at HelloApplication.main(

I'm sorry there are some Chinese characters which you may not read.
The last line: client1mmix is my result. But why the above exception?

I'll paste my and the source of my client application at the end. Can somebody help me with the problem and is there anything to do when use a complex data type as the parameter of the web service?

Thanks for your patience and your time.


package hello;

public class NewClass implements {
    private String value;
    /** Creates a new instance of NewClass */
    public NewClass() {
    public NewClass(String s) {
        value = s;
    public synchronized void setValue(String a) {
        value = a;
    public synchronized String getValue() {
        return value;

//the client application

import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.Stub;
import javax.xml.rpc.handler.*;
import java.util.*;

public class HelloApplication {
    public static void main(String[] args) {
       String url = "";
       String namespace = "urn:HelloWorld/wsdl";
       String serviceName = "HelloWorld";
       QName serviceQN = new QName(namespace, serviceName);
       try {
       ServiceFactory serviceFactory = ServiceFactory.newInstance();
       Service service = serviceFactory.createService(new URL(url), serviceQN);
       Stub stub = createProxy();
       stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, url);
       hello.HelloWorldSEI chello = (hello.HelloWorldSEI)stub;
       hello.NewClass nc = new hello.NewClass("aaaa");
       System.out.println(chello.sayHello(nc)); //throws the exception
       } catch(Exception e) {
    public static Stub createProxy() {
        return (Stub) (new hello.HelloWorld_Impl().getHelloWorldSEIPort());