hello users,

i've got a problem a still can't handle,
i want to send an array of base64binarys.

this is the way to my prob :

1. this is my java interface, the description of a service

public interface aService {
        public Person getPerson(int i);
        public int setPerson(Person p);
}
class Person {
        public String name;
        public int age;

        public int[] images;    // later i change to xmime:base64Binary
        public int[] someInts;
        public String[] someStrings;
}

2. i generate with java2wsdl
   output is 'aService_orig.wsdl'

3. change the wsdl :
   output is 'aService.wsdl'

3.1. set definitions
        xmlns:xmime="http://www.w3.org/2005/05/xmlmime";

3.2. set import
        <xs:import namespace="http://www.w3.org/2005/05/xmlmime";
                schemaLocation="xmime.xsd"/>

3.3. change type
        <xs:element maxOccurs="unbounded" minOccurs="0" name="images" 
nillable="true"
type="xs:int"/>
        to
        <xs:element maxOccurs="unbounded" minOccurs="0" name="images" 
nillable="true"
type="xmime:base64Binary"/>

4. then i generate c- and java- sources with wsdl2java/wsdl2c
        c-server : -ss -sd -d adb -u
        java-server : -ss -sd -g -d adb -u


5. first i build the java code

5.1 implementation of the skeleton, setResponse :

   public org.apache.ws.axis2.SetPersonResponse setPerson(
        org.apache.ws.axis2.SetPerson setPerson) {

        // get Person
        org.apache.ws.axis2.xsd.Person person = setPerson.getParam0();

        // get ints
        int[] ints = person.getSomeInts();
        System.out.println("count of ints : " + ints.length);
        for (int i=0; i<ints.length; i++) {
            System.out.println("no. " + i + " => " + ints[i]);
        }

        // get strings
        String[] strings = person.getSomeStrings();
        System.out.println("count of strings : " + strings.length);
        for (int i=0; i<strings.length; i++) {
            System.out.println("no. " + i + " => " + strings[i]);
        }

        // get b64bs
        org.w3.www._2005._05.xmlmime.Base64Binary[] b64bs = person.getImages();
        System.out.println("count of b64bs : " + b64bs.length);


                // response
                org.apache.ws.axis2.SetPersonResponse response = new
org.apache.ws.axis2.SetPersonResponse();
                response.set_return(12345);
                return response;
    }


5.2 implementation of the a little client-test :

        try {
                AServiceStub stub = new AServiceStub();
                SetPerson setPerson = new SetPerson();
                Person person = new Person();
                SetPersonResponse setPersonResponse = null;

                // set simple things
                person.setName("aName");
                person.setAge(123);

                //person.addImages()
                //person.addSomeStrings()
                // aber nicht addSomeInts() !!!


                // set ints
                int[] ints = new int[3];
                ints[0] = 1;
                ints[1] = 2;
                ints[2] = 3;
                person.setSomeInts(ints);


                // set strings
                String[] strings = new String[5];
                strings[0] = "str_1";
                strings[1] = "str_2";
                strings[2] = "str_3";
                strings[3] = "str_4";
                strings[4] = "str_5";
                person.setSomeStrings(strings);


                // set images
                Base64Binary[] b64bs = new Base64Binary[2];

                 // prepare base64bin
                File file = new File("X:\\_test\\test.jpg");
                FileDataSource fileDataSource = new FileDataSource(file);
                DataHandler dataHandler = new DataHandler(fileDataSource);
                Base64Binary b64bin = new Base64Binary();
                b64bin.setBase64Binary(dataHandler);

                b64bs[0] = b64bin;
                b64bs[1] = b64bin;
                person.setImages(b64bs);


                // set param
                setPerson.setParam0(person);

                // call the method
                setPersonResponse = stub.setPerson(setPerson);

                // response
                System.out.println("back : " + setPersonResponse.get_return() );
        } catch (AxisFault ex) {
                ex.printStackTrace();
        } catch (RemoteException ex) {
                ex.printStackTrace();
        }

        this works fine, output at serverside is :

        count of ints : 3
        no. 0 => 1
        no. 1 => 2
        no. 2 => 3
        count of strings : 5
        no. 0 => str_1
        no. 1 => str_2
        no. 2 => str_3
        no. 3 => str_4
        no. 4 => str_5
        count of b64bs : 2

        [i could even save the files to disk]

6. second step i want to communicate my java-test-program with
   the c-service, when i try to compile one error occours in
   'adb_base64Binary.c' error 176, element_qname, not defined
   i set it like qname : 'axutil_qname_t *element_qname = NULL;'
   ok, service compiles fine (i didn't implement anything else !)

7. my problem, occurs, when calling the c-service with my java-client,
   the server crashes, when trying to deserialize in
'adb_base64Binary_deserialize'

   here is the relevant stack :

   axutil.dll!axutil_string_get_buffer(const axutil_string * string=0x00031208,
const axutil_env * env=0x008f4328)  Zeile 228 + 0x3 Bytes       C
   axiom.dll!axiom_namespace_get_prefix(axiom_namespace *
om_namespace=0x008f65b0, const axutil_env * env=0x008f4328)  Zeile 202 + 0x10
Bytes   C
   axiom.dll!axiom_element_get_qname(axiom_element * om_element=0x00927840,
const axutil_env * env=0x008f4328, axiom_node * ele_node=0x00927800)  Zeile 906
+ 0xd Bytes     C
   aService.dll!adb_base64Binary_deserialize(adb_base64Binary *
_base64Binary=0x0095b628, const axutil_env * env=0x008f4328, axiom_node *
parent=0x00927800)  Zeile 169 + 0x14 Bytes      C
   aService.dll!adb_Person_deserialize(adb_Person * _Person=0x0095b3b8, const
axutil_env * env=0x008f4328, axiom_node * parent=0x008f6040)  Zeile 297 + 0x1e
Bytes   C
   aService.dll!adb_setPerson_deserialize(adb_setPerson * _setPerson=0x0095b168,
const axutil_env * env=0x008f4328, axiom_node * parent=0x008f5ce8)  Zeile 196 +
0x1b Bytes      C
   aService.dll!axis2_svc_skel_aService_invoke(axis2_svc_skeleton *
svc_skeleton=0x0095b098, const axutil_env * env=0x008f4328, axiom_node *
content_node=0x008f5ce8, axis2_msg_ctx * msg_ctx=0x0095ae90)  Zeile 187 C
   ...

   i don't know how to handle this - any ideas ?
   need more infos ?

mfg derMark

Attachment: aService.wsdl
Description: application/xml

Attachment: aService_orig.wsdl
Description: application/xml

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to