Search EggHeadCafe's Job Board
EggHeadCafe Silverlight WPF ASP.NET VB.NET C# Excel SQL Server SharePoint
search
MicrosoftArticlesForumsFAQs
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml / Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

WebArticlesForumsFAQs
JavaScript
ASP
ASP.NET
WCF

DatabasesArticlesForumsFAQs
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsFAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money

Non-MicrosoftArticlesForumsFAQs
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

Operating SysArticlesForumsFAQs
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsFAQs
BizTalk
Site Server
Exhange Server
IIS

Graphic DesignArticlesForumsFAQs
Macromedia Flash
Adobe PhotoShop
Expression Blend
Expression Design
Expression Web

OtherArticlesForumsFAQs
Lounge
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Product Reviews
Search Engines
Resumes

 

  View Other C# .NET Posts   Ask New Question  Ask New Question With Power Editor

Need Sample code of cunsuming /itg/ppmservices/DemandService (HP Demand Management) in WCF
Vijendra Patil posted at Saturday, November 07, 2009 10:44 AM

Hi,

I am trying to consume JAVA AXIS 2 web service ( /itg/ppmservices/DemandService (HP Demand Management) in WCF. But i am getting exception. Since this web service is using WSE 3 and with WCF the support for WSE is not provided, i ma not able to access any of the web methods of that web service.

 

If anybody is having sample code then please do tell me.

Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0
What is the error you get?
[)ia6l0 iii provided a helpful rated reply to Vijendra Patil on Saturday, November 07, 2009 12:18 PM

The most probable error would be the failure to map the WSE properties from the policy file to the WCF bindings. 

MSDN article here outlines how to interopate your WCF clients or WCF Services with WSE. Look how the SecurityBindingElement is replaced with the WSEHttpBinding in the sample source code provided in that article.

Also, from another article here, this transcript below covers all that you need:
"Windows Communication Foundation (WCF) clients are wire-level compatible with Web Services Enhancements (WSE) 3.0 for Microsoft .NET services when WCF clients are configured to use the August 2004 version of the WS-Addressing specification. However, WSE 3.0 services do not support the metadata exchange (MEX) protocol, so when you use the Service Metadata Utility Tool (SvcUtil.exe) to create a WCF client class, the security settings are not applied to the generated WCF client. Therefore, you must specify the security settings that the WSE 3.0 service requires after the WCF client is generated.

You can apply these security settings by using a custom binding to take into account the WSE 3.0 service's requirements and the interoperable requirements between a WSE 3.0 service and a WCF client. These interoperability requirements include the aforementioned use of the August 2004 WS-Addressing specification and the WSE 3.0default message protection of SignBeforeEncrypt. The default message protection for WCF is SignBeforeEncryptAndEncryptSignature. "

This article can be read from here and it has sufficient code coverage.

Reply    Reply Using Power Editor
  Rank Winnings Points
November 1 $217.00 560
October 1 $226.00 771

Need Sample code of cunsuming /itg/ppmservices/DemandService (HP Demand Management) in WCF
Vijendra Patil replied to [)ia6l0 iii on Sunday, November 08, 2009 12:31 AM

I’m using a service that is using username token authentication and it’s built in wse 3.0.

http://msdn2.microsoft.com/en-US/library/aa480575.aspx

 

I am trying to interop with it via wcf like so:

http://msdn2.microsoft.com/en-us/library/ms730299.aspx

 

Code Snippet

the vendor who makes the service has given me the following policy file

<policies xmlns="http://schemas.microsoft.com/wse/2005/06/policy">

  <extensions>

    <extension name="usernameOverTransportSecurity" type="Microsoft.Web.Services3.Design.UsernameOverTransportAssertion, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

    <extension name="requireActionHeader" type="Microsoft.Web.Services3.Design.RequireActionHeaderAssertion, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

  </< SPAN>extensions>

  <policy name="InsertNameHere">

    <usernameOverTransportSecurity />

    <requireActionHeader />

  </< SPAN>policy>

</< SPAN>policies>

 

 

 

However, the services are NOT on SSL they’re hosted on basic HTTP.

 

I wrote the following client to try to talk to the service

 

Code Snippet

           Console.Write("Logging in...");

 

            //Configure an anon binding so we can log in

            WseHttpBinding binding = new WseHttpBinding();

            binding.LoadPolicy("wse3policyCache.config", "InsertNameHere");

 

            LoginServiceSoapClient loginClient =

         new LoginServiceSoapClient(binding,

         new EndpointAddress("HTTP://myserver/myLoginService.asmx") );

            Guid guid = loginClient.LogIn("username", "myP4ssw0rd",true);

 

 

 

            Console.WriteLine("Logged in!");

            Console.WriteLine(" (press any key to exit) ");

            Console.ReadKey();

 

 

           

 

Now I’m stuck because it says that http isn’t valid, but if I use https it can’t find the certificate, because there isn’t one.

 

Thanks,

Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0

Need Sample code of cunsuming /itg/ppmservices/DemandService (HP Demand Management) in WCF
Vijendra Patil replied to [)ia6l0 iii on Sunday, November 08, 2009 7:55 AM

Glad for your reply.

 

I am getting error as "Scheme http doesnt supported"

Actually I am using ClearUserNameBinding (code available on internet) for this issue. But the thing here is, the technique which I am using is like HACKING. I am implementing the ISecurityCapabelity class.

WCF doesnt go well with WSE 3.0.

Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0