We are attempting to make a request to a web service (we will refer to it as
XXXServices) hosted on a Web Logic server from a C# SOAP client. The server
responds with a 401 Unauthorized error (that appears in plain text), and
causes the client to crash. This C# code has been deployed both as an
ASP.NET application and a WinForms app, each of which produced the same
result. Further, moving the clients from a Windows XP machine to Windows
2003 Server on a different network resulted in the same errant behavior.
However, a Java client that accesses the same web service succeeds. We
employed an HTTP packet sniffer to examine the difference between the
Request and Response interaction between the respective clients and the
server. First, here is the C# client's request:
Hypertext Transfer Protocol
POST /xxxservices/ws HTTP/1.1\r\n
Request Method: POST
Request URI: /xxxervices/ws
Request Version: HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client
Protocol 1.1.4322.2032)\ r\n
Content-Type: text/xml; charset=utf-8\r\n
SOAPAction: ""\r\n
Content-Length: 790\r\n
Expect: 100-continue\r\n
Connection: Keep-Alive\r\n
Host: xxxxx.xxxxxxxxx xx.com\r\n
\r\n
Next, here is the request made by the Java client
Hypertext Transfer Protocol
POST /xxxservices/ws?wsdl HTTP/1.1\r\n
Request Method: POST
Request URI: /xxxservices/ws?wsdl
Request Version: HTTP/1.1
Content-Type: text/xml\r\n
SOAPAction: ""\r\n
Authorization: Basic xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxx=\r\n
Credentials: username:passwo rd
User-Agent: Java/1.5.0_05\r\n
Host: xxxxx.xxxxxxxxx xx.com\r\n
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n
Connection: keep-alive\r\n
Content-Length: 686\r\n
\r\n
Here is the C# client code, which fails:
try
{
XXXServices service = new XXXServices();
String userName = "username";
String password = "password";
NetworkCredenti al cred = new NetworkCredenti al(userName,pas sword);
service.Credent ials = cred;
String appString = "appstring" ;
String xmlReq = "A string that contains XML data";
textBox1.Text = service.Url + Environment.New Line +
service.sendxml (appString,xmlR eq);
}
catch(Exception ex)
{
textBox1.Text = ex.ToString();
}
Finally, here is the Java code, which succeeds:
try
{
String
wsdlUrl="http://xxxxx.xxxxxxxxx xx.com/xxxservices/ws?wsdl";
System.out.prin tln("Getting proxy to = "+wsdlUrl);
XXXServices service = new XXXServices_Imp l();
XXXServicesPort _Stub stub = (XXXServicesPor t_Stub)
service.getXXXS ervicesPort();
stub._setProper ty(javax.xml.rp c.Stub.USERNAME _PROPERTY,"user name");
stub._setProper ty(javax.xml.rp c.Stub.PASSWORD _PROPERTY,"pass word");
stub._setProper ty(javax.xml.rp c.Stub.ENDPOINT _ADDRESS_PROPER TY,
wsdlUrl);
XXXServicesPort port = (XXXServicesPor t) stub;
String xmlTrans = "A string that contains XML data";
System.out.prin tln("Sending transaction: "+xmlTrans) ;
String result = port.sendxml("a ppstring",xmlTr ans);
System.out.prin tln("Result = "+result);
}
catch(Exception e)
{
System.out.prin tln(e.toString( ));
e.printStackTra ce();
}
The ideal outcome to this problem involves somehow "fixing" the C# code so
it plays nicely with the Web Logic server. We have entertained the
following possible approaches:
1. Deploy the Java code as some kind of intermediate "translator "
between C# and Java SOAP formats
2. Integrate the Java code using Interop into the C# client, so that
all the Web Service interaction is done in Java, but the business logic
remains C#
3. Overload the auto-generated C# proxy to produce a header that
"looks-like" the Java header.
None of these seems particular "right." Further, we're not entirely sure
how we would do any of them, since we are mostly a .NET shop and have little
Java experience. Our operations group is also not crazy about running an
Apache server to host the Java code, if it comes to that.
Can anyone on this list recommend either a) a better solution that works or
b) an implementation approach to one of the above-mentioned solutions, 1, 2
or 3? We would also be very interested to hear about similar experiences
and solutions that have succeeded or failed. Lastly, if this is a
documented problem that Microsoft, Sun, BEA (or whoever) knows about, and
someone can point us to an article, that would be very helpful.
Many thanks in advance.
-Nate 5 12523
Nate,
Try setting your "service .PreAuthenticat e = true" on your proxy object
before making the call to the ws method.
If that does not work (cross your fingers ;-) Then you may need to look at
WSE so that you can create a SoapContext object and a UsernameToken object
rather than the build in credentials.
UsernameToken userToken = new New UsernameToken(" name", "pw",
PasswordOption. SendPlainText) ;
SoapContext requestContext = service .RequestSoapCon text ;
requestContext. Security.Tokens .Add(userToken) ;
requestContext. Timestamp.Ttl = 60000;
requestContext. Path.EncodedMus tUnderstand = "false";
Best of luck,
John Scragg
"Nate" wrote: We are attempting to make a request to a web service (we will refer to it as XXXServices) hosted on a Web Logic server from a C# SOAP client. The server responds with a 401 Unauthorized error (that appears in plain text), and causes the client to crash. This C# code has been deployed both as an ASP.NET application and a WinForms app, each of which produced the same result. Further, moving the clients from a Windows XP machine to Windows 2003 Server on a different network resulted in the same errant behavior.
However, a Java client that accesses the same web service succeeds. We employed an HTTP packet sniffer to examine the difference between the Request and Response interaction between the respective clients and the server. First, here is the C# client's request:
Hypertext Transfer Protocol POST /xxxservices/ws HTTP/1.1\r\n Request Method: POST Request URI: /xxxervices/ws Request Version: HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 1.1.4322.2032)\ r\n Content-Type: text/xml; charset=utf-8\r\n SOAPAction: ""\r\n Content-Length: 790\r\n Expect: 100-continue\r\n Connection: Keep-Alive\r\n Host: xxxxx.xxxxxxxxx xx.com\r\n \r\n Next, here is the request made by the Java client
Hypertext Transfer Protocol POST /xxxservices/ws?wsdl HTTP/1.1\r\n Request Method: POST Request URI: /xxxservices/ws?wsdl Request Version: HTTP/1.1 Content-Type: text/xml\r\n SOAPAction: ""\r\n Authorization: Basic xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxx=\r\n Credentials: username:passwo rd User-Agent: Java/1.5.0_05\r\n Host: xxxxx.xxxxxxxxx xx.com\r\n Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n Connection: keep-alive\r\n Content-Length: 686\r\n \r\n Here is the C# client code, which fails: try { XXXServices service = new XXXServices(); String userName = "username"; String password = "password";
NetworkCredenti al cred = new NetworkCredenti al(userName,pas sword);
service.Credent ials = cred;
String appString = "appstring" ; String xmlReq = "A string that contains XML data";
textBox1.Text = service.Url + Environment.New Line + service.sendxml (appString,xmlR eq);
} catch(Exception ex) {
textBox1.Text = ex.ToString(); } Finally, here is the Java code, which succeeds: try { String wsdlUrl="http://xxxxx.xxxxxxxxx xx.com/xxxservices/ws?wsdl"; System.out.prin tln("Getting proxy to = "+wsdlUrl); XXXServices service = new XXXServices_Imp l(); XXXServicesPort _Stub stub = (XXXServicesPor t_Stub) service.getXXXS ervicesPort();
stub._setProper ty(javax.xml.rp c.Stub.USERNAME _PROPERTY,"user name");
stub._setProper ty(javax.xml.rp c.Stub.PASSWORD _PROPERTY,"pass word"); stub._setProper ty(javax.xml.rp c.Stub.ENDPOINT _ADDRESS_PROPER TY, wsdlUrl); XXXServicesPort port = (XXXServicesPor t) stub; String xmlTrans = "A string that contains XML data"; System.out.prin tln("Sending transaction: "+xmlTrans) ; String result = port.sendxml("a ppstring",xmlTr ans); System.out.prin tln("Result = "+result);
} catch(Exception e) { System.out.prin tln(e.toString( )); e.printStackTra ce(); }
The ideal outcome to this problem involves somehow "fixing" the C# code so it plays nicely with the Web Logic server. We have entertained the following possible approaches:
1. Deploy the Java code as some kind of intermediate "translator " between C# and Java SOAP formats 2. Integrate the Java code using Interop into the C# client, so that all the Web Service interaction is done in Java, but the business logic remains C# 3. Overload the auto-generated C# proxy to produce a header that "looks-like" the Java header.
None of these seems particular "right." Further, we're not entirely sure how we would do any of them, since we are mostly a .NET shop and have little Java experience. Our operations group is also not crazy about running an Apache server to host the Java code, if it comes to that.
Can anyone on this list recommend either a) a better solution that works or b) an implementation approach to one of the above-mentioned solutions, 1, 2 or 3? We would also be very interested to hear about similar experiences and solutions that have succeeded or failed. Lastly, if this is a documented problem that Microsoft, Sun, BEA (or whoever) knows about, and someone can point us to an article, that would be very helpful.
Many thanks in advance
I have tried using the service.PreAuth enticate, and it stills fails to
include credentials in the WebLogic web service request.
Are there really no solution to this problem?
If you know how to do a Basic authentication up against a WebLogic web
service please tell.
Best Regards,
Morten
"John Scragg" wrote: Nate,
Try setting your "service .PreAuthenticat e = true" on your proxy object before making the call to the ws method.
If that does not work (cross your fingers ;-) Then you may need to look at WSE so that you can create a SoapContext object and a UsernameToken object rather than the build in credentials.
UsernameToken userToken = new New UsernameToken(" name", "pw", PasswordOption. SendPlainText) ;
SoapContext requestContext = service .RequestSoapCon text ;
requestContext. Security.Tokens .Add(userToken) ; requestContext. Timestamp.Ttl = 60000; requestContext. Path.EncodedMus tUnderstand = "false";
Best of luck,
John Scragg
"Nate" wrote:
We are attempting to make a request to a web service (we will refer to it as XXXServices) hosted on a Web Logic server from a C# SOAP client. The server responds with a 401 Unauthorized error (that appears in plain text), and causes the client to crash. This C# code has been deployed both as an ASP.NET application and a WinForms app, each of which produced the same result. Further, moving the clients from a Windows XP machine to Windows 2003 Server on a different network resulted in the same errant behavior.
However, a Java client that accesses the same web service succeeds. We employed an HTTP packet sniffer to examine the difference between the Request and Response interaction between the respective clients and the server. First, here is the C# client's request:
Hypertext Transfer Protocol POST /xxxservices/ws HTTP/1.1\r\n Request Method: POST Request URI: /xxxervices/ws Request Version: HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 1.1.4322.2032)\ r\n Content-Type: text/xml; charset=utf-8\r\n SOAPAction: ""\r\n Content-Length: 790\r\n Expect: 100-continue\r\n Connection: Keep-Alive\r\n Host: xxxxx.xxxxxxxxx xx.com\r\n \r\n Next, here is the request made by the Java client
Hypertext Transfer Protocol POST /xxxservices/ws?wsdl HTTP/1.1\r\n Request Method: POST Request URI: /xxxservices/ws?wsdl Request Version: HTTP/1.1 Content-Type: text/xml\r\n SOAPAction: ""\r\n Authorization: Basic xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxx=\r\n Credentials: username:passwo rd User-Agent: Java/1.5.0_05\r\n Host: xxxxx.xxxxxxxxx xx.com\r\n Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n Connection: keep-alive\r\n Content-Length: 686\r\n \r\n Here is the C# client code, which fails: try { XXXServices service = new XXXServices(); String userName = "username"; String password = "password";
NetworkCredenti al cred = new NetworkCredenti al(userName,pas sword);
service.Credent ials = cred;
String appString = "appstring" ; String xmlReq = "A string that contains XML data";
textBox1.Text = service.Url + Environment.New Line + service.sendxml (appString,xmlR eq);
} catch(Exception ex) {
textBox1.Text = ex.ToString(); } Finally, here is the Java code, which succeeds: try { String wsdlUrl="http://xxxxx.xxxxxxxxx xx.com/xxxservices/ws?wsdl"; System.out.prin tln("Getting proxy to = "+wsdlUrl); XXXServices service = new XXXServices_Imp l(); XXXServicesPort _Stub stub = (XXXServicesPor t_Stub) service.getXXXS ervicesPort();
stub._setProper ty(javax.xml.rp c.Stub.USERNAME _PROPERTY,"user name");
stub._setProper ty(javax.xml.rp c.Stub.PASSWORD _PROPERTY,"pass word"); stub._setProper ty(javax.xml.rp c.Stub.ENDPOINT _ADDRESS_PROPER TY, wsdlUrl); XXXServicesPort port = (XXXServicesPor t) stub; String xmlTrans = "A string that contains XML data"; System.out.prin tln("Sending transaction: "+xmlTrans) ; String result = port.sendxml("a ppstring",xmlTr ans); System.out.prin tln("Result = "+result);
} catch(Exception e) { System.out.prin tln(e.toString( )); e.printStackTra ce(); }
The ideal outcome to this problem involves somehow "fixing" the C# code so it plays nicely with the Web Logic server. We have entertained the following possible approaches:
1. Deploy the Java code as some kind of intermediate "translator " between C# and Java SOAP formats 2. Integrate the Java code using Interop into the C# client, so that all the Web Service interaction is done in Java, but the business logic remains C# 3. Overload the auto-generated C# proxy to produce a header that "looks-like" the Java header.
None of these seems particular "right." Further, we're not entirely sure how we would do any of them, since we are mostly a .NET shop and have little Java experience. Our operations group is also not crazy about running an Apache server to host the Java code, if it comes to that.
Can anyone on this list recommend either a) a better solution that works or b) an implementation approach to one of the above-mentioned solutions, 1, 2 or 3? We would also be very interested to hear about similar experiences and solutions that have succeeded or failed. Lastly, if this is a documented problem that Microsoft, Sun, BEA (or whoever) knows about, and someone can point us to an article, that would be very helpful.
Many thanks in advance
Hello,
I have the same problem (although the server is Lotus/Domino). I just can't
get my code to send out the basic authorization tag on the first request.
In my case, the server does not respond with a 401, but sends back a html
login screen, which causes the call to the webservice to crash.
I've setup the credential cache, and set PreAuthenticate to true. Packet
sniffer shows that nothing is sent.
I'm using framework 2.0 with VS 2005
"Striboldt" wrote: I have tried using the service.PreAuth enticate, and it stills fails to include credentials in the WebLogic web service request. Are there really no solution to this problem?
If you know how to do a Basic authentication up against a WebLogic web service please tell.
Best Regards, Morten
"John Scragg" wrote:
Nate,
Try setting your "service .PreAuthenticat e = true" on your proxy object before making the call to the ws method.
If that does not work (cross your fingers ;-) Then you may need to look at WSE so that you can create a SoapContext object and a UsernameToken object rather than the build in credentials.
UsernameToken userToken = new New UsernameToken(" name", "pw", PasswordOption. SendPlainText) ;
SoapContext requestContext = service .RequestSoapCon text ;
requestContext. Security.Tokens .Add(userToken) ; requestContext. Timestamp.Ttl = 60000; requestContext. Path.EncodedMus tUnderstand = "false";
Best of luck,
John Scragg
"Nate" wrote:
We are attempting to make a request to a web service (we will refer to it as XXXServices) hosted on a Web Logic server from a C# SOAP client. The server responds with a 401 Unauthorized error (that appears in plain text), and causes the client to crash. This C# code has been deployed both as an ASP.NET application and a WinForms app, each of which produced the same result. Further, moving the clients from a Windows XP machine to Windows 2003 Server on a different network resulted in the same errant behavior.
However, a Java client that accesses the same web service succeeds. We employed an HTTP packet sniffer to examine the difference between the Request and Response interaction between the respective clients and the server. First, here is the C# client's request:
Hypertext Transfer Protocol POST /xxxservices/ws HTTP/1.1\r\n Request Method: POST Request URI: /xxxervices/ws Request Version: HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 1.1.4322.2032)\ r\n Content-Type: text/xml; charset=utf-8\r\n SOAPAction: ""\r\n Content-Length: 790\r\n Expect: 100-continue\r\n Connection: Keep-Alive\r\n Host: xxxxx.xxxxxxxxx xx.com\r\n \r\n Next, here is the request made by the Java client
Hypertext Transfer Protocol POST /xxxservices/ws?wsdl HTTP/1.1\r\n Request Method: POST Request URI: /xxxservices/ws?wsdl Request Version: HTTP/1.1 Content-Type: text/xml\r\n SOAPAction: ""\r\n Authorization: Basic xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxx=\r\n Credentials: username:passwo rd User-Agent: Java/1.5.0_05\r\n Host: xxxxx.xxxxxxxxx xx.com\r\n Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n Connection: keep-alive\r\n Content-Length: 686\r\n \r\n Here is the C# client code, which fails: try { XXXServices service = new XXXServices(); String userName = "username"; String password = "password";
NetworkCredenti al cred = new NetworkCredenti al(userName,pas sword);
service.Credent ials = cred;
String appString = "appstring" ; String xmlReq = "A string that contains XML data";
textBox1.Text = service.Url + Environment.New Line + service.sendxml (appString,xmlR eq);
} catch(Exception ex) {
textBox1.Text = ex.ToString(); } Finally, here is the Java code, which succeeds: try { String wsdlUrl="http://xxxxx.xxxxxxxxx xx.com/xxxservices/ws?wsdl"; System.out.prin tln("Getting proxy to = "+wsdlUrl); XXXServices service = new XXXServices_Imp l(); XXXServicesPort _Stub stub = (XXXServicesPor t_Stub) service.getXXXS ervicesPort();
stub._setProper ty(javax.xml.rp c.Stub.USERNAME _PROPERTY,"user name");
stub._setProper ty(javax.xml.rp c.Stub.PASSWORD _PROPERTY,"pass word"); stub._setProper ty(javax.xml.rp c.Stub.ENDPOINT _ADDRESS_PROPER TY, wsdlUrl); XXXServicesPort port = (XXXServicesPor t) stub; String xmlTrans = "A string that contains XML data"; System.out.prin tln("Sending transaction: "+xmlTrans) ; String result = port.sendxml("a ppstring",xmlTr ans); System.out.prin tln("Result = "+result);
} catch(Exception e) { System.out.prin tln(e.toString( )); e.printStackTra ce(); }
The ideal outcome to this problem involves somehow "fixing" the C# code so it plays nicely with the Web Logic server. We have entertained the following possible approaches:
1. Deploy the Java code as some kind of intermediate "translator " between C# and Java SOAP formats 2. Integrate the Java code using Interop into the C# client, so that all the Web Service interaction is done in Java, but the business logic remains C# 3. Overload the auto-generated C# proxy to produce a header that "looks-like" the Java header.
None of these seems particular "right." Further, we're not entirely sure how we would do any of them, since we are mostly a .NET shop and have little Java experience. Our operations group is also not crazy about running an Apache server to host the Java code, if it comes to that.
Can anyone on this list recommend either a) a better solution that works or b) an implementation approach to one of the above-mentioned solutions, 1, 2 or 3? We would also be very interested to hear about similar experiences and solutions that have succeeded or failed. Lastly, if this is a documented problem that Microsoft, Sun, BEA (or whoever) knows about, and someone can point us to an article, that would be very helpful.
Many thanks in advance
I too am having this problem. I have waded my way through literally hundreds
of posts on this topic and no one can seem to solve the problem.
I just need to add "AUTHORIZAT ION" to the HTTP Header (not SOAP Header - so
I can't use "ws.Credentials ").
PLEASE MS - HELP US!!!!!!!!
The webservice I'm trying to connect to is written with PHP on Apache. To
complicate matters, I'm trying to do this on the Compact Framework. I have
seen some posts regarding the Overriding of GetWebRequest with this CSharp
code:- http://groups.google.com.au/group/mi...058abceb9610f8 (although I would prefer VB).
I cannot work out where this Override goes? It cannot override the method
in the base class for my WebService Proxy (SoapHttpClient Protocol), and I
would hate to have to roll-my-own Proxy for the WebService when wsdl.exe does
most of what I need.
Please help. I have a looming deadline that I'm struggling to meet.
Many thanks in advance.
Joe
"DStone" wrote: Hello,
I have the same problem (although the server is Lotus/Domino). I just can't get my code to send out the basic authorization tag on the first request.
In my case, the server does not respond with a 401, but sends back a html login screen, which causes the call to the webservice to crash.
I've setup the credential cache, and set PreAuthenticate to true. Packet sniffer shows that nothing is sent.
I'm using framework 2.0 with VS 2005
"Striboldt" wrote:
I have tried using the service.PreAuth enticate, and it stills fails to include credentials in the WebLogic web service request. Are there really no solution to this problem?
If you know how to do a Basic authentication up against a WebLogic web service please tell.
Best Regards, Morten
"John Scragg" wrote:
Nate,
Try setting your "service .PreAuthenticat e = true" on your proxy object before making the call to the ws method.
If that does not work (cross your fingers ;-) Then you may need to look at WSE so that you can create a SoapContext object and a UsernameToken object rather than the build in credentials.
UsernameToken userToken = new New UsernameToken(" name", "pw", PasswordOption. SendPlainText) ;
SoapContext requestContext = service .RequestSoapCon text ;
requestContext. Security.Tokens .Add(userToken) ; requestContext. Timestamp.Ttl = 60000; requestContext. Path.EncodedMus tUnderstand = "false";
Best of luck,
John Scragg
"Nate" wrote:
> We are attempting to make a request to a web service (we will refer to it as > XXXServices) hosted on a Web Logic server from a C# SOAP client. The server > responds with a 401 Unauthorized error (that appears in plain text), and > causes the client to crash. This C# code has been deployed both as an > ASP.NET application and a WinForms app, each of which produced the same > result. Further, moving the clients from a Windows XP machine to Windows > 2003 Server on a different network resulted in the same errant behavior. > > However, a Java client that accesses the same web service succeeds. We > employed an HTTP packet sniffer to examine the difference between the > Request and Response interaction between the respective clients and the > server. First, here is the C# client's request: > > > Hypertext Transfer Protocol > POST /xxxservices/ws HTTP/1.1\r\n > Request Method: POST > Request URI: /xxxervices/ws > Request Version: HTTP/1.1 > User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client > Protocol 1.1.4322.2032)\ r\n > Content-Type: text/xml; charset=utf-8\r\n > SOAPAction: ""\r\n > Content-Length: 790\r\n > Expect: 100-continue\r\n > Connection: Keep-Alive\r\n > Host: xxxxx.xxxxxxxxx xx.com\r\n > \r\n > > > > Next, here is the request made by the Java client > > Hypertext Transfer Protocol > POST /xxxservices/ws?wsdl HTTP/1.1\r\n > Request Method: POST > Request URI: /xxxservices/ws?wsdl > Request Version: HTTP/1.1 > Content-Type: text/xml\r\n > SOAPAction: ""\r\n > Authorization: Basic xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxx=\r\n > Credentials: username:passwo rd > User-Agent: Java/1.5.0_05\r\n > Host: xxxxx.xxxxxxxxx xx.com\r\n > Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n > Connection: keep-alive\r\n > Content-Length: 686\r\n > \r\n > > > > Here is the C# client code, which fails: > > > > try > { > XXXServices service = new XXXServices(); > String userName = "username"; > String password = "password"; > > NetworkCredenti al cred = new NetworkCredenti al(userName,pas sword); > > service.Credent ials = cred; > > String appString = "appstring" ; > String xmlReq = "A string that contains XML data"; > > textBox1.Text = service.Url + Environment.New Line + > service.sendxml (appString,xmlR eq); > > > } > catch(Exception ex) > { > > textBox1.Text = ex.ToString(); > } > > > > Finally, here is the Java code, which succeeds: > > > > try > { > String > wsdlUrl="http://xxxxx.xxxxxxxxx xx.com/xxxservices/ws?wsdl"; > System.out.prin tln("Getting proxy to = "+wsdlUrl); > XXXServices service = new XXXServices_Imp l(); > XXXServicesPort _Stub stub = (XXXServicesPor t_Stub) > service.getXXXS ervicesPort(); > > stub._setProper ty(javax.xml.rp c.Stub.USERNAME _PROPERTY,"user name"); > > stub._setProper ty(javax.xml.rp c.Stub.PASSWORD _PROPERTY,"pass word"); > stub._setProper ty(javax.xml.rp c.Stub.ENDPOINT _ADDRESS_PROPER TY, > wsdlUrl); > XXXServicesPort port = (XXXServicesPor t) stub; > String xmlTrans = "A string that contains XML data"; > System.out.prin tln("Sending transaction: "+xmlTrans) ; > String result = port.sendxml("a ppstring",xmlTr ans); > System.out.prin tln("Result = "+result); > > } > catch(Exception e) > { > System.out.prin tln(e.toString( )); > e.printStackTra ce(); > } > > > The ideal outcome to this problem involves somehow "fixing" the C# code so > it plays nicely with the Web Logic server. We have entertained the > following possible approaches: > > > 1. Deploy the Java code as some kind of intermediate "translator " > between C# and Java SOAP formats > 2. Integrate the Java code using Interop into the C# client, so that > all the Web Service interaction is done in Java, but the business logic > remains C# > 3. Overload the auto-generated C# proxy to produce a header that > "looks-like" the Java header. > > > None of these seems particular "right." Further, we're not entirely sure > how we would do any of them, since we are mostly a .NET shop and have little > Java experience. Our operations group is also not crazy about running an > Apache server to host the Java code, if it comes to that. > > > Can anyone on this list recommend either a) a better solution that works or > b) an implementation approach to one of the above-mentioned solutions, 1, 2 > or 3? We would also be very interested to hear about similar experiences > and solutions that have succeeded or failed. Lastly, if this is a > documented problem that Microsoft, Sun, BEA (or whoever) knows about, and > someone can point us to an article, that would be very helpful. > > Many thanks in advance
Yes. This was bugging me too. So here's some code that'll do Basic Auth:
Firstly you need to sub-class the WebService class generated by 'Add Web reference' as follows (lets assume the generated web service is called GeneratedWebSer vice): - public class MyWebService : GeneratedWebService
-
{
-
private String m_HeaderName;
-
private String m_HeaderValue;
-
-
//----------------
-
// GetWebRequest
-
//
-
// Called by the SOAP client class library
-
//----------------
-
protected override WebRequest GetWebRequest(Uri uri)
-
{
-
// call the base class to get the underlying WebRequest object
-
HttpWebRequest req = (HttpWebRequest)base.GetWebRequest(uri);
-
-
if (null != this.m_HeaderName)
-
{
-
// set the header
-
req.Headers.Add(this.m_HeaderName, this.m_HeaderValue);
-
}
-
-
// return the WebRequest to the caller
-
return (WebRequest)req;
-
}
-
-
//----------------
-
// SetRequestHeader
-
//
-
// Sets the header name and value that GetWebRequest will add to the
-
// underlying request used by the SOAP client when making the
-
// we method call
-
//----------------
-
public void SetRequestHeader(String headerName, String headerValue)
-
{
-
this.m_HeaderName = headerName;
-
this.m_HeaderValue = headerValue;
-
}
-
}
Then set up the web service as follows: - MyWebService svc1 = new MyWebService();
-
byte[] bcred = Encoding.ASCII.GetBytes("username:password");
-
string b64cred = Convert.ToBase64String(bcred);
-
svc1.SetRequestHeader("Authorization", "Basic " + b64cred);
Replace username and password with an actual username and password.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Glauco |
last post by:
I'm trying to use SOAPpy 0.10.1 for a client but is difficult to handle
easly
Is this library in use or i'm using an OLD death library ?
I'm alone in find a lot of problem in a SOAP Client ?
I'm going crazy because function are not documented .
Exist another solution for di a SOAP CLient ??
|
by: Denis |
last post by:
I have to test a web service that uses soap as an interface.
I could need some lightweiht program that takes text file or a user
input and passes it to the server as a soap request and displays the
response. Would be very helpful for me.
|
by: Mr Bouffant |
last post by:
Hi:
I have two "identical" servers (W2K Server SP3, XML parser, SOAPSDK
etc.) on which I have installed a web service I wrote using C++/ATL.
On box two it works fine. I can invoke it from javascript and from a
bit of VB I wrote using the SOAP SDK. Lovely.
On box one it does not work. I get the HRESULT=0x800A1527
SOAP.FaultString=Connector:Connection time out error.
|
by: Eirik Brattbakk |
last post by:
Hi
I have some problems accessing a soap service made in c# using an
ATL/MFC client over SSL. I have tried both CSoapMSXMLInetClient and
CSoapWininetClient as template arguments with my stub class.
The service is returning with the error code: -2147467259. I have not
succeeded to find any additional information about the error. The
"SoapFault" method seems to return only a bunch of question marks.
|
by: jennifer.perkins |
last post by:
I've seen a couple posts by people having similar problems, but the
suggested solutions I've tried so far haven't worked.
I'm using a SOAP client in VB.Net (constructed by wsdl.exe) and the
third party web service it's consuming is served by Axis. The request
messages my client sends are processed fine by the server, and the SOAP
response is making its way to my client - but when .Net finishes
processing the message I end up with an...
| |
by: kencana |
last post by:
hi All,
I got problem in passing data (more than one) from soap client to the soap server. but if i only passing one data at a time, it works successfully..
The following is the error message i get when i pass more than one data:
"SoapFault exception: looks like we got no XML document in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\phpviewersample\clienttry2.php:24 Stack trace: #0 : SoapClient->__call('getMap', Array) #1...
|
by: =?Utf-8?B?QWRyaWFuIENvbGU=?= |
last post by:
I have written a simple WCF service hosted in a Windows console application
and a simple WCF client console application that connects successfully to
that service and retrieves data. I then ported the console application to
WinForms and also got that to work properly.
My next move was to host the WCF service in a Windows service application. I
believe I have that working correctly, but I can't for the life of me get a
client to connect...
|
by: Enda Manni |
last post by:
Hi,
I have a gSoap Web Service written using C++, it uses SOAP username and
password authentication.
I also have a C# form client consuming the web service, all this was working
fine until I added the authentication on the server, now I can not get the
client to authenticate. Can someone tell me how to add authentication info
to the SOAP message posted from the C# SOAP client.
|
by: monsalvo |
last post by:
Hello.
I've just coded a VBScript SOAP Client to send requests to a web
service in our intranet. It's working and we'll use it in a DTS cuz we
have not implemented SQL Server 2005 yet. Anyway. I need some more
functionality. For example with the script below I'm able to get the
Session ID Token from our web service and save the full SOAP xml
Envelope to a file. But What if for example I want to save certain
nodes I receive in the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |