all groups > dotnet xml > february 2004 >
You're in the

dotnet xml

group:

Webservice client fails on even numbered calls



Webservice client fails on even numbered calls paul NO[at]SPAM palmnospam.com
2/26/2004 6:21:14 PM
dotnet xml: Hi,

I have an unmanaged VC7 app calling a C# dotnet service. I'm using the
VS2003 generated proxy class derived from
CSoapSocketClientT. The client app works fine for most of my customers, but
for some it appears to be upset by their firewall / proxy.

If I use CSoapSocketClientT.SetProxy(NULL) to pick up the proxy settings
from IE, attempting to call a web method fails on every second call with
SOAP_CLIENT_SEND_ERROR, any idea on what is happening here? I can change
the order of the calls to the web methods and it still fails on every second
call. If I don't call SetProxy(NULL) then it works fine on all calls. I
have tested the proxy settings in IE and they are correct and working.

Also, I'm trying to handle the situation where a proxy requires
authentication. After a bit of searching I came up with:

m_pSUws->SetProxy(NULL);
CAtlHttpClient& httpClient = m_pSUws->m_socket;
CNTLMAuthObject authNTLM;
CBasicAuthObject authBASIC;
httpClient.AddAuthObj(_T("NTLM"), &authNTLM);
httpClient.AddAuthObj(_T("BASIC"), &authBASIC);
httpClient.NegotiateAuth(true);

m_pSUws is the CSoapSocketClientT derived proxy class. Am I on the right
track with this?

Thanks,

Paul

Re: Webservice client fails on even numbered calls paul NO[at]SPAM palmnospam.com
3/1/2004 8:58:47 AM
Ok, I found out I need to derive a class from CBasicAuthObject and collect
the username / password. I'm still stuck with calls to the web method
failing on every even numbered attempt.

Thanks,

Paul

[quoted text, click to view]

RE: Webservice client fails on even numbered calls timhuang NO[at]SPAM online.microsoft.com
3/2/2004 5:18:17 PM
Hello Paul,

Thanks for your post. As I understand, the problem you are facing is that
your ATL client fails to call a web service on even number, and it works
fine if you do not call CSoapSocketClientT::SetProxy. Please correct me if
there is any misunderstanding. I think more information is needed before
moving forward:

1. As I know, m_pSUws is an instance of the CSoapSocketClientT derived
proxy class. Do you delete the m_pSUws object and create a new one for each
call?

2. Did you call CSoapSocketClientT::CleanupClient which should be called to
clean up the current request and response before making another request?

3. Is it possible to post a sample project and tell us the detailed steps
to reproduce the problem? I will be glad to test it on my side.

I look forward to your response.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Re: Webservice client fails on even numbered calls paul NO[at]SPAM palmnospam.com
3/3/2004 2:14:39 PM
Hi Tian,

Thanks for looking at this.

1), no, I create a single instance and delete it only when the app closes

2) yes

3) Here is a condensation of the code:

m_pSUws = new CSmartUpdateT<CSoapSocketClientT<> > ();
m_pSUws->SetTimeout(30000);
if (m_dlgOptions.m_bUseProxy)
m_pSUws->SetProxy(NULL);
CAtlHttpClient& httpClient = m_pSUws->m_socket;
CNTLMAuthObject *authNTLM = new CNTLMAuthObject;
CSampleBasicAuth *authBASIC = new CSampleBasicAuth;
httpClient.AddAuthObj(_T("basic"), authBASIC,authBASIC);
httpClient.AddAuthObj(_T("NTLM"), authNTLM);

m_pSUws->CleanupClient();
HRESULT hres = m_pSUws>WebMethod1(..);
m_pSUws->CleanupClient();
hres = m_pSUws->WebMethod2(..);
m_pSUws->CleanupClient();
hres = m_pSUws->WebMethod3(..);
m_pSUws->CleanupClient();
hres = m_pSUws->WebMethod4(..);
m_pSUws->CleanupClient();

WebMethod 1 & 3 will succeed, 2 & 4 will fail.

The app fails to launch on Windows 98 clients, the implementation of
CNTLMAuthObject is linked to some missing exports in secure32.dll. The
HTTPClientSample also has this problem - there an update to the source that
fixes this?

Also, is there an example of how to do derive from CNTLMAuthObject when the
windows logon credentials fail the proxy authentication and the user should
be prompted to supply different ones?

Kind Regards,

Paul

[quoted text, click to view]

Re: Webservice client fails on even numbered calls sgyuan NO[at]SPAM online.microsoft.com
3/9/2004 11:06:59 AM
Hi Paul,

The problem is a little strange. I guess the problem is related to the
proxy server since if you don't use it, everything is working fine. I
believe you can also try the CSoapWininetClient to see how does it work?

If CSoapWininetClient also have this problem, you can use the Network
Monitor to capture the network traffic between the client machine and the
proxy server, and check it to see if there is any thing abnormal there. You
can also do a trace on a machine that the application can work correctly.
By comparing the network traffic, you may be able to find out the cause of
the problem.

For information regarding using Network Monitor, you can refer to:

How to Capture Network Traffic with Network Monitor
http://support.microsoft.com/?id=148942

David Yuan.
Microsoft Online Partner Support
Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Re: Webservice client fails on even numbered calls paul NO[at]SPAM palmnospam.com
3/11/2004 9:14:25 PM
Hi David,

Thanks. I have tried capturing the network traffic, though I couldn't
figure out what the problem was. The proxy returned 2 empty frames before
failing. I have worked around the problem by destroying and recreating the
connection between each call - though this will take it's toll on proxy's
that require NTLM authentication.

How do I get the VC++ webservice proxy generator to create classes based on
CSoapWininetClient rather than CAtlSoapClient?

Thanks,

Paul
[quoted text, click to view]

Re: Webservice client fails on even numbered calls yhhuang NO[at]SPAM online.microsoft.com
3/16/2004 7:14:23 AM
Hi Paul,

CSoapWininetClient also conforms to ATL Server's SOAP client archetype.
That is to say, we can use it with SPROXY-generated classes which build up
the SOAP messages for us, but it is possible to use this class
independently in the following way:

1) Create an instance and pass the location of the XML Web service to the
constructor.
2) Call SetProxy or SetTimeout if necessary.
3) Call GetWriteStream and write the SOAP message to that stream.
4) Call SendRequest to send the SOAP message to the server.
5) If SendRequest succeeded, call GetReadStream to read the SOAP response.
6) If SendRequest failed, call GetClientError and GetStatusCode, or look at
m_fault for error information.
7) Call CleanupClient before returning to Step 3 to send further messages

For more information on it, please refer to MSDN topic:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/
vclrfCSoapWininetClient.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html
/vcconSProxyexe.asp

Hope that helps.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Re: Webservice client fails on even numbered calls v-kevy NO[at]SPAM online.microsoft.com
3/17/2004 5:44:56 AM
Hi Paul,

Thanks for your feedback. We will forward it to the appropriate team.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Re: Webservice client fails on even numbered calls paul NO[at]SPAM palmnospam.com
3/17/2004 9:35:07 AM
Hi Yanhong,

Thanks, that works great. It has fixed all the problems, including ones I
was having with NTLM authentication on proxy servers. I think you guys
should dump the CAtlHttpClient based classes as they seem buggy and
incomplete.

Kind Regards,

Paul


[quoted text, click to view]

AddThis Social Bookmark Button