axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Preston <PREST...@uk.ibm.com>
Subject WSDL2WS problems creating stubs from UDDI WSDL
Date Mon, 07 Jun 2004 15:39:12 GMT
Hi All,
        I'm trying to create stubs from a WSDL I obtained from the UDDI 
website (http://uddi.org/wsdl/inquire_v2.wsdl). WSDL2WS will not process 
the WSDL without error.  I can fix the errors, and the WSDL2WS will 
produce C++ stubs, but the stubs are not completely correct and have to be 
altered by hand.  Below are the areas where the code fails in WSDL2WS...

CUtils.java
        Minor changes, but did not record.

WSDL2WS.java
        Removed line 317 otherwise could not find all the names.

183:    private ArrayList getServiceInfo(PortType porttype)throws 
WrapperFault {
184:        //get operation list
   :
314:                            pinfo = new 
ParameterInfo(type,part.getName());
315: pinfo.setElementName(part.getElementName());
316:                            //remove the type that represents the 
wrapping element so that such type is not created.
317://                  this.typeMap.removeType(qname);
318:                            }
319:                    }

BeanParamWritter.java
        Added lines 125, 126, 127 128, 129 and 131 to allow these four 
names to generate code.  Otherwise an error occurs because these names are 
not of 'basic type'.  When the stubs have been generated, these four files 
need to be amended as shown later in the text.

122:    writer.write("\t/* first serialize attributes if any*/\n");
123:    for(int i = 0; i< attributeParamCount;i++){
124:            if(attribs[i].isArray() || !(attribs[i].isSimpleType())){
125:                    if( !("truncated".equals(attribs[i].getLangName()) 
||
126:                            "generic".equals(attribs[i].getLangName()) 
||
127:                            "keyType".equals(attribs[i].getLangName()) 
||
128:                            "direction"
.equals(attribs[i].getLangName())))
129:                    {
130:            throw new WrapperFault("Error : the attribute " + 
attribs[i].getLangName() + " is not basic type");
131:                    }
132:            }
133:    else{

ArrayParamWriter.java
        Added lines 49, 50 and 58 then 80, 81 and 83 so that 
NullPoinerException was not thrown when classname was null.

44:     public void writeSource()throws WrapperFault{
45:        try{
46:                     this.writer = new BufferedWriter(new 
FileWriter(getFilePath(), false));
47:                     writeClassComment();
48:                     // if this headerfile not defined define it
49:                     if(classname != null)
50:                     {
  :
58:                     }

80:     if( classname != null)
81:     {
82:     this.writer.write("#endif /* !defined(__"+
                                classname.toUpperCase()+"_"+
                                getFileType().toUpperCase()+
                                "_H__INCLUDED_)*/\n");
83:     }

The stubs produced are accurate except for truncated, generic, keyType and 
direction.  The following common code changes (shown in bold text) are 
required to each file before it will compile...

direction.cpp

/*
 *This file is automatically generated by the Axis C++ Wrapper Class 
Generator
 *Web service wrapper class's implementation generated by Axis WCG
 *Parameters and wrapper methods to manipulate direction
 */

#include <malloc.h>
#include <axis/server/AxisWrapperAPI.h>

#include "direction.h"

/*
 * This static method serialize a direction type of object
 */
int Axis_Serialize_direction(direction* param, IWrapperSoapSerializer* 
pSZ, bool bArray = false)
{
        printf("Warning - no code for Axis_Serialize_direction()");
/*
        if ( param == NULL ) {
         // TODO : may need to check nillable value
        pSZ->serializeAsAttribute("xsi:nil", 0, 
(void*)&(xsd_boolean_true), XSD_BOOLEAN);
         pSZ->serialize(">", NULL);
        return AXIS_SUCCESS;
        }
        // first serialize attributes if any
        if (0 != param->generic)
                pSZ->serializeAsAttribute("generic", 0, 
(void*)&(param->generic), XSD_STRING);
        pSZ->serialize(">", 0);
        // then serialize elements if any//
        pSZ->serializeAsElement("authInfo", (void*)&(param->authInfo), 
XSD_STRING);
 pSZ->serializeCmplxArray((Axis_Array*)(&param->publisherAssertion_Ref),
                (void*) Axis_Serialize_publisherAssertion, (void*) 
Axis_Delete_publisherAssertion, (void*) Axis_GetSize_publisherAssertion,
                "publisherAssertion", Axis_URI_publisherAssertion);
*/
        return AXIS_SUCCESS;
}

/*
 * This static method deserialize a direction type of object
 */
int Axis_DeSerialize_direction(direction* param, IWrapperSoapDeSerializer 
*pIWSDZ)
{
        printf("Warning - no code for Axis_DeSerialize_direction()");
/*
        Axis_Array array;
        param->generic = pIWSDZ->getAttributeAsString("generic",0);
        param->authInfo = pIWSDZ->getElementAsString("authInfo",0);
        array = 
pIWSDZ->getCmplxArray((void*)Axis_DeSerialize_publisherAssertion
                , (void*)Axis_Create_publisherAssertion, 
(void*)Axis_Delete_publisherAssertion
                , (void*)Axis_GetSize_publisherAssertion, 
"publisherAssertion", Axis_URI_publisherAssertion);
        param->publisherAssertion_Ref = (publisherAssertion_Array&)array;
*/
        return pIWSDZ->getStatus();
}

void* Axis_Create_direction(direction* pObj, bool bArray = false, int 
nSize=0)
{
        if (bArray && (nSize > 0))
        {
                if (pObj)
                {
                        direction* pNew = new direction[nSize];
                        memcpy(pNew, pObj, sizeof(direction)*nSize/2);
                        memset(pObj, 0, sizeof(direction)*nSize/2);
                        delete [] pObj;
                        return pNew;
                }
                else
                {
                        return new direction[nSize];
                }
        }
        else
                return new direction;
}

/*
 * This static method delete a direction type of object
 */
void Axis_Delete_direction(direction* param, bool bArray = false, int 
nSize=0)
{
        if (bArray)
        {
                delete [] param;
        }
        else
        {
                delete param;
        }
}

/*
 * This static method gives the size of direction type of object
 */
int Axis_GetSize_direction()
{
        return sizeof(direction);
}

int Check_Restrictions_direction(direction value)
{
        return 0;
}

direction.h
/*
 *This file is automatically generated by the Axis C++ Wrapper Class 
Generator
 *Web service wrapper class's implementation generated by Axis WCG
 *Parameters and wrapper methods to manipulate direction
 */

#if !defined(__DIRECTION_PARAM_H__INCLUDED_)
#define __DIRECTION_PARAM_H__INCLUDED_

class direction
{
};

static const char* Axis_URI_direction = "urn:uddi-org:api_v2";

#endif /* !defined(__DIRECTION_PARAM_H__INCLUDED_)*/


        Has anyone experienced these problems or know how to correctly 
parse the UDDI inquire_v2.wsdl?

Regards,

Fred Preston.
Software Engineer
Business Integration

Mail Point 188,  IBM Hursley Park
Winchester, Hampshire, SO21 2JN, UK 
Notes id:    Fred Preston/UK/IBM @ IBMGB
Internet:      prestonf@uk.ibm.com
Tel:             +44 1962 817180
Internal:      247180

Mime
View raw message