You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2005/08/04 11:53:07 UTC

cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws DeploymentWriter.java WsddWriter.java

samisa      2005/08/04 02:53:07

  Modified:    c/src/engine/server ServerAxisEngine.cpp
               c/src/wsdd WSDDDocument.cpp WSDDDocument.h WSDDKeywords.cpp
                        WSDDKeywords.h WSDDService.cpp WSDDService.h
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws
                        DeploymentWriter.java WsddWriter.java
  Log:
  Added the fix for the problem of server failing due to operation name being different from request tag name.
  This fix necessasitates changes to server.wsdd syntax
  
  Revision  Changes    Path
  1.32      +6 -2      ws-axis/c/src/engine/server/ServerAxisEngine.cpp
  
  Index: ServerAxisEngine.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/engine/server/ServerAxisEngine.cpp,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- ServerAxisEngine.cpp	2 Aug 2005 09:47:55 -0000	1.31
  +++ ServerAxisEngine.cpp	4 Aug 2005 09:53:07 -0000	1.32
  @@ -200,9 +200,13 @@
               sOperation = sOperation.substr (0, sOperation.length () - 1);
           }
   
  -        m_pMsgData->setOperationName (sOperation.c_str ());
  +        AxisString operationToInvoke = m_pService->getOperationForRequest(sOperation.c_str());
   
  -        if (m_pService->isAllowedMethod (sOperation.c_str ()))
  +        printf("%s\n", operationToInvoke.c_str());
  +
  +        m_pMsgData->setOperationName (operationToInvoke.c_str ());
  +
  +        if (m_pService->isAllowedMethod (operationToInvoke.c_str ()))
           {
               /* load actual web service handler */
               if (AXIS_SUCCESS != g_pHandlerPool->getWebService (&m_pWebService, 
  
  
  
  1.42      +27 -0     ws-axis/c/src/wsdd/WSDDDocument.cpp
  
  Index: WSDDDocument.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdd/WSDDDocument.cpp,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- WSDDDocument.cpp	23 May 2005 18:03:05 -0000	1.41
  +++ WSDDDocument.cpp	4 Aug 2005 09:53:07 -0000	1.42
  @@ -458,6 +458,10 @@
           {
               addAllowedMethodsToService(pcValue);
           }
  +        else if (0 == strcmp(pcName, kw_operation_request_map))
  +        {
  +            addOperationToRequestMappingsToService( pcValue );
  +        }
           else if(0 == strcmp(pcName, kw_cn))
           {
               m_pService->setLibName(pcValue);
  @@ -540,6 +544,29 @@
       }
   }
   
  +void WSDDDocument::addOperationToRequestMappingsToService(const AxisXMLCh* pcValue)
  +{
  +    AxisString sValue = pcValue;
  +    unsigned int prepos = 0, pos = 0;
  +        do
  +        {
  +            pos = sValue.find(METHODNAME_SEPARATOR, prepos);
  +            if (AxisString::npos == pos) // Handle the case of no trailing space in AllowedMethods
  +                pos = sValue.size();
  +            if (pos <= prepos) break;
  +            AxisString operationRequestPair = sValue.substr(prepos, pos - prepos);
  +            unsigned int seperatorPoint = operationRequestPair.find(TAG_NAME_SEPARATOR, 0 );
  +            if (AxisString::npos != seperatorPoint)
  +            {
  +                AxisString operationName = operationRequestPair.substr(0, seperatorPoint );
  +                AxisString requestName = operationRequestPair.substr( seperatorPoint + 1, operationRequestPair.length() );
  +                m_pService->addOperationRequestMapping(operationName, requestName);
  +            }
  +            prepos = pos + 1;
  +        } while (true);
  +}
  +
  +
   
   void WSDDDocument::startElement(const AnyElement* pEvent)
   {
  
  
  
  1.21      +2 -0      ws-axis/c/src/wsdd/WSDDDocument.h
  
  Index: WSDDDocument.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdd/WSDDDocument.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- WSDDDocument.h	6 Aug 2004 14:44:41 -0000	1.20
  +++ WSDDDocument.h	4 Aug 2005 09:53:07 -0000	1.21
  @@ -39,6 +39,7 @@
   
   #define METHODNAME_SEPARATOR ' '
   #define ROLENAME_SEPARATOR ','
  +#define TAG_NAME_SEPARATOR ':'
   #define TRANSCODE_BUFFER_SIZE 1024
   
   /*
  @@ -91,6 +92,7 @@
       void getParameters(WSDDLevels eElementType, const AnyElement* pEvent);
       void addAllowedRolesToService(const AxisXMLCh* pcValue);
       void addAllowedMethodsToService(const AxisXMLCh* pcValue);
  +    void addOperationToRequestMappingsToService(const AxisXMLCh* pcValue);
       int parseDocument(const AxisChar* pcWSDDFileName);
   protected: 
       bool m_bFatalError;
  
  
  
  1.15      +2 -0      ws-axis/c/src/wsdd/WSDDKeywords.cpp
  
  Index: WSDDKeywords.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdd/WSDDKeywords.cpp,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- WSDDKeywords.cpp	6 Aug 2004 14:44:41 -0000	1.14
  +++ WSDDKeywords.cpp	4 Aug 2005 09:53:07 -0000	1.15
  @@ -34,6 +34,7 @@
   const AxisXMLCh* kw_prv;
   const AxisXMLCh* kw_cn; /* must be changed to libname or so */
   const AxisXMLCh* kw_am;
  +const AxisXMLCh* kw_operation_request_map; //To handle the mapping between operation name and request tag name
   const AxisXMLCh* kw_ar;
   const AxisXMLCh* kw_rqf;
   const AxisXMLCh* kw_rsf;
  @@ -76,6 +77,7 @@
           kw_prv = __TRC("provider");
           kw_cn = __TRC("className"); /* must be changed to libname or so */
           kw_am = __TRC("allowedMethods");
  +        kw_operation_request_map = __TRC("operationRequestMap");
           kw_ar = __TRC("allowedRoles");
           kw_rqf = __TRC("requestFlow");
           kw_rsf = __TRC("responseFlow");
  
  
  
  1.11      +1 -0      ws-axis/c/src/wsdd/WSDDKeywords.h
  
  Index: WSDDKeywords.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdd/WSDDKeywords.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- WSDDKeywords.h	23 Nov 2004 17:21:06 -0000	1.10
  +++ WSDDKeywords.h	4 Aug 2005 09:53:07 -0000	1.11
  @@ -31,6 +31,7 @@
   extern const AxisXMLCh* kw_prv;
   extern const AxisXMLCh* kw_cn; /* must be changed to libname or so */
   extern const AxisXMLCh* kw_am;
  +extern const AxisXMLCh* kw_operation_request_map; //To handle the mapping between operation name and request tag name
   extern const AxisXMLCh* kw_ar;
   extern const AxisXMLCh* kw_rqf;
   extern const AxisXMLCh* kw_rsf;
  
  
  
  1.27      +24 -0     ws-axis/c/src/wsdd/WSDDService.cpp
  
  Index: WSDDService.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdd/WSDDService.cpp,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- WSDDService.cpp	12 Jul 2005 04:48:12 -0000	1.26
  +++ WSDDService.cpp	4 Aug 2005 09:53:07 -0000	1.27
  @@ -251,4 +251,28 @@
       return 0;
   }
   
  +void WSDDService::addOperationRequestMapping(AxisString operation, AxisString request)
  +{
  +    operationRequestMap[operation] = request;
  +}
  +
  +const char* WSDDService::getOperationForRequest(const char* request) const
  +{
  +    AxisString strRequest = request;
  +    map<AxisString, AxisString>::const_iterator itr = operationRequestMap.find(strRequest);
  +
  +    if (itr != operationRequestMap.end() ) // handle the case where the tag name is the same as the operation name
  +        return (*itr).first.c_str();
  +
  +    itr = operationRequestMap.begin();
  +    
  +    while (itr != operationRequestMap.end() && (*itr).second != strRequest)
  +        ++itr;
  +
  +    if (itr != operationRequestMap.end())
  +        return (*itr).first.c_str();
  +    else 
  +        return NULL;
  +}
  +
   AXIS_CPP_NAMESPACE_END
  
  
  
  1.13      +3 -0      ws-axis/c/src/wsdd/WSDDService.h
  
  Index: WSDDService.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdd/WSDDService.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- WSDDService.h	23 Nov 2004 17:21:06 -0000	1.12
  +++ WSDDService.h	4 Aug 2005 09:53:07 -0000	1.13
  @@ -37,6 +37,8 @@
       const AxisChar* getServiceName() const;
       bool isAllowedMethod(const AxisChar* sMethodName) const;
       void addAllowedMethod(const AxisChar* sMethodName);
  +    void addOperationRequestMapping(AxisString operation, AxisString request);
  +    const char* getOperationForRequest(const char* request) const;
       const WSDDHandlerList* getResponseFlowHandlers() const;
       void addHandler(bool bRequestFlow, WSDDHandler* pHandler);
       int removeHandler(bool bRequestFlow, WSDDHandler* pHandler);
  @@ -54,6 +56,7 @@
       WSDDHandlerList* m_RequestHandlers;
       WSDDHandlerList* m_ResponseHandlers;
       list<AxisString> m_AllowedRoles;
  +    map<AxisString, AxisString> operationRequestMap;
   };
   
   typedef map<AxisString, WSDDService*> WSDDServiceMap;
  
  
  
  1.4       +8 -0      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/DeploymentWriter.java
  
  Index: DeploymentWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/DeploymentWriter.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DeploymentWriter.java	9 Apr 2004 08:49:31 -0000	1.3
  +++ DeploymentWriter.java	4 Aug 2005 09:53:07 -0000	1.4
  @@ -48,6 +48,14 @@
   				writer.write((String)it.next()+" ");
   			}
   			writer.write("\"/>\n");
  +                        // operation and request tag name mapping
  +			writer.write("\t\t<parameter name=\"operationRequestMap\" value=\"");
  +			it = this.allowedmethods.iterator();
  +                        Iterator it2 = this.requestNames.iterator();
  +			while (it.hasNext()){
  +				writer.write((String)it.next() + ":" + (String)it2.next() + " ");
  +			}
  +			writer.write("\"/>\n");
   			writer.write("\t</service>\n");
   			writer.write("</deployment>\n");
   			writer.flush();
  
  
  
  1.5       +4 -0      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WsddWriter.java
  
  Index: WsddWriter.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WsddWriter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WsddWriter.java	23 Mar 2005 15:45:03 -0000	1.4
  +++ WsddWriter.java	4 Aug 2005 09:53:07 -0000	1.5
  @@ -39,6 +39,8 @@
       protected String providerStyle = null;
       protected String description = null;
       protected Vector allowedmethods = new Vector();
  +    protected Vector requestNames = new Vector();
  +    protected Vector responseNames = new Vector();
       WebServiceContext wscontext = null;
       public WsddWriter(WebServiceContext wscontext) throws WrapperFault
       {
  @@ -70,6 +72,8 @@
           {
               minfo = (MethodInfo) methods.get(i);
               allowedmethods.add(minfo.getMethodname());
  +            requestNames.add( minfo.getInputMessage().getLocalPart() );
  +            responseNames.add( minfo.getOutputMessage().getLocalPart() );
           }
   
       }