none
WsRequestReply get E_INVALIDARG ?

    Question

  • I have a simple WebService in .NET, no SSL, no proxy, only in localhost. I copy this client code from here http://code.msdn.microsoft.com/windowsdesktop/Windows-Web-HTTP-client-715b3547/view/Discussions. I make a few change to disable SSL by change &securityDecristion to NULL in WsCreateChannel. Modify with my ws struct with Plus and PlusReponse (I also have other methods but not use in here).

    	// Create a heap to store deserialized data
    	hr = WsCreateHeap(
    		/*maxSize*/ 2048, 
    		/*trimSize*/ 512, 
    		NULL, 
    		0, 
    		&heap, 
    		error);
    	if (FAILED(hr))
    	{
    		goto Exit;
    	}
    
    	// Create a channel
    	hr = WsCreateChannel(
    		WS_CHANNEL_TYPE_REQUEST, 
    		WS_HTTP_CHANNEL_BINDING, 
    		NULL, 
    		0, 
    		NULL,
    		&channel, 
    		error);
    	if (FAILED(hr))
    	{
    		goto Exit;
    	}
    
    	hr = WsCreateMessageForChannel(
    		channel,
    		NULL, 
    		0, 
    		&requestMessage, 
    		error);
    	if (FAILED(hr))
    	{
    		goto Exit;
    	}
    
    	hr = WsCreateMessageForChannel(
    		channel,
    		NULL, 
    		0, 
    		&replyMessage, 
    		error);
    	if (FAILED(hr))
    	{
    		goto Exit;
    	}
    
    	// Initialize address of service
    	address.url = serviceUrl;
    	address.headers = NULL;
    	address.extensions = NULL;
    	address.identity = NULL;
    
    	// Open channel to address
    	hr = WsOpenChannel(channel, &address, NULL, error);
    	if (FAILED(hr))
    	{
    		goto Exit;
    	}
    
    	// Initialize plus order
    	_Plus plusInput;
    	plusInput.x1 = 100;
    	plusInput.x2 = 51;
    
    	_PlusResponse plusResponse;
    
    	// Send plus order, get plus result
    	hr = WsRequestReply(
    		channel,
    		requestMessage, 
    		&Webservice_wsdl.messages.PlusSoapIn, 
    		WS_WRITE_REQUIRED_VALUE,
    		&plusInput,
    		sizeof(plusInput),
    		replyMessage, 
    		&Webservice_wsdl.messages.PlusSoapOut, 
    		WS_READ_REQUIRED_VALUE, 
    		heap, 
    		&plusResponse, 
    		sizeof(plusResponse), 
    		NULL, 
    		error);

    When call WsRequestReply, I get error E_INVALIDARG. My WebService install in IIS, run in .NET app and in web browser both ok. I'll try proxy and SSL after, but now I can not run even a simple success.

    I also look around for other sample, but others are more complex than this SSL sample.

    Thanks for help.


    • Edited by Spy Hunter Friday, May 11, 2012 4:21 AM
    Friday, May 11, 2012 4:20 AM