axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "White, Darran" <Darran.Wh...@cognos.com>
Subject Getting endpoints from WSDL for dynamic client
Date Tue, 28 Nov 2006 16:28:43 GMT
Hi,
I`m trying to use the dynamic client to access the Amazon
AWSECommerceService and I`m just trying to work out how the endpoints
get set.
I`m successfully parsing the Amazon wsdl and getting a dynamic client
back. However it doesn`t appear to have any endpoints set though there
is definitely an entry in the WSDL for the service location. When I try
to execute my request I get a "cannot infer transport from URL"
presumabley because the endpoint is not set. When I try to get the
endpoint from the client it is returning a null pointer.

How are these endpoints supposed to be set???

Heres the WSDL location
http://webservices.amazon.com/AWSECommerceService/UK/AWSECommerceService
.wsdl

Code below.

Thanks

Darran

m_pSvc_client =
        axis2_svc_client_create_for_dynamic_invocation(
            m_pEnv,NULL, pWsdl_uri, pWsdl_svc_qname,service,
m_pClient_home);

    if (!m_pSvc_client)
    {
		printf("%s\n",AXIS2_ERROR_GET_MESSAGE(m_pError));
        printf("Error creating service client, Please check AXIS2C_HOME
again\n");
				
        AXIS2_LOG_DEBUG(m_pEnv->log, AXIS2_LOG_SI, "Service client is
NULL");
		//TODO throw exception
    }
	else
	{
		//Try and get the endpoints from the service 
		axis2_svc_t * pSvc =
m_pSvc_client->ops->get_svc(m_pSvc_client,m_pEnv);
		axis2_hash_t * pHashEndpoints =
pSvc->wsdl_svc->ops->get_endpoints( pSvc->wsdl_svc,m_pEnv);
		
		if(pHashEndpoints)
		{
			 axis2_hash_index_t *hi=0;
			 void* val = 0;
			 for (hi =
axis2_hash_first(pHashEndpoints,m_pEnv); hi; hi =
axis2_hash_next(m_pEnv, hi)) 
			 {
 			   axis2_hash_this(hi, NULL, NULL, &val);
			   axis2_endpoint_ref_t* pEndpoint =
(axis2_endpoint_ref_t*)val;
	
printf("%s",pEndpoint->ops->get_address(pEndpoint,m_pEnv));
			 }
		}

		//Try and get the endpoint from the client
		const axis2_endpoint_ref_t * pEndPoint =
	
m_pSvc_client->ops->get_target_endpoint_ref(m_pSvc_client,m_pEnv);
	
		if(!pEndPoint)
		{
			printf("No endpoint set for service");
			return;
		}

		const axis2_char_t *buffer =
pEndPoint->ops->get_address(pEndPoint,m_pEnv);
	
printf("%s",pEndPoint->ops->get_address(pEndPoint,m_pEnv));
	}
 
       This message may contain privileged and/or confidential information.  If you have received
this e-mail in error or are not the intended recipient, you may not use, copy, disseminate
or distribute it; do not open any attachments, delete it immediately from your system and
notify the sender promptly by e-mail that you have done so.  Thank you.

Mime
View raw message