Create a Web Service with .NET WCF. Plink, plink, done.

Create a simple Java client to call that web service. Using the default Java SE 7u2 SDK + runtime downloadable from Oracle, you run wsimport to import the service WSDL and generate proxy classes. You write a little code to instantiate the service class and call the service, run the app, and see the output from the successful web service call. Done! Well, not exactly.

When you run the Java client console app, the calls to the web service work but are accompanied by rather nasty sounding warnings about unknown policy requirements.

Jan 04, 2012 12:10:46 PM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector] selectAlternatives
WARNING: WSP0075: Policy assertion "{http://www.w3.org/2006/05/addressing/wsdl}UsingAddressing" was evaluated as "UNKNOWN".
Jan 04, 2012 12:10:46 PM [com.sun.xml.internal.ws.policy.EffectiveAlternativeSelector] selectAlternatives
WARNING: WSP0019: Suboptimal policy alternative selected on the client side with fitness "UNKNOWN"

How do we get rid of those warnings? There are certainly ways to suppress warning reports, but that’s not the right solution. The better question is how do we resolve the issue reported in the warning?

After a great deal of digging around, here’s what I’ve found:

  1. WCF defaults to placing a wsaw:UsingAddressing WS-Policy assertion in your web service WSDL.
  2. wsaw:UsingAddressing is not actually part of any SOAP standard, it’s some sort of WSDL extension to cover the gap until an official SOAP WS-Policy standard could be defined later.
  3. Microsoft WCF supports wsaw:UsingAddressing.
  4. Java’s JAX-WS reference implementation web service core framework (JAX-WS RI 2.2.4-b01) bundled with the JDK does not support wsaw:UsingAddressing. The rationalization seems to be that wsaw:UsingAddressing isn’t part of the WS-Policy spec, so “not our problem”. JAX-WS RI supports wsam:Addressing from the official WS-Policy spec.
  5. This isn’t just Java folks thumbing their noses at Microsoft. This also causes interop problems with Java web service frameworks that support and use wsaw:UsingAddressing.
  6. Java Metro is another web service framework, and one which does support wsaw:UsingAddressing. Metro is the result of Sun and Microsoft working together to resolve cross-platform web service interop issues.
  7. Metro is easy enough to download, but how do you use it? Documentation is all about how to install Metro into an application server environment. Many app developers have asked “How do I use Metro in my Java client?”

As it turns out, Metro appears to do all of its magic at runtime. There is no IDE integration at all. All you need to do is reference the Metro .jar files in your Java project and the WS-Policy warnings will go away.

In the NetBeans IDE, this means adding each of the .jar files from the Metro/lib directory to the Libraries node in your Java project. Make sure they appear before the JDK reference. Make sure you select the actual .jar files, not just the Metro/lib directory.

In the IntelliJ IDE, this means:

  1. Right click on the JDK node under “External Libraries” in the project tree
  2. Click “Open Library Settings”
  3. Click “Libraries” under “Project Settings”
  4. Click the New Project Library tool button
  5. Click “Java”
  6. Select the Metro/lib subdir in the “Select Library Files” path selector dialog.

Note that in NetBeans, you have to select the actual .jar files; selecting only the Metro/lib directory won’t work in NetBeans.  Selecting only the Metro/lib directory works fine in IntelliJ.

To solve this UsingAddressing policy issue from the Java client end, use the Metro libraries. Period.

Another way to solve this interop issue would be to address the service end: Add wsam:Addresssing as an acceptable alternative to wsaw:UsingAddressing in the web service’s WSDL. With both addressing policies as siblings under an <ExactlyOne> element, clients that support wsaw:UsingAddressing will be happy and clients that support only wsam:Addressing will be happy. In theory, anyway.

However, I have yet to figure out how to add wsam:Addressing to the WSDL generated by a WCF service. Since I have a client-side solution I won’t be pursuing this further, but if anyone can provide a link to how to do this on the WCF WSDL side, I’d love to see that solution as well.

Jul 152011
 

Kudos to ZCorp for their recent new video reaching a lot of people (3.9 million views on YouTube as of this writing) who clearly had never heard of 3d printing before. However, all these 3D noobs blathering on about “wow! 3D printing is brand new!” and “star trek replicators are real!” is really becoming irritating.  [...]

 

Google+’s Circles feature to organize your contacts into distinct groups is generating a lot of discussion about how to best use this new tool.  Some people are exited to finally have a degree of privacy and publishing control not found in Twitter, Facebook or other social sites. But is this privacy control or merely “privacy [...]

Jul 022011
 

We’ve had a Brother MFC 5860CN multifunction printer/fax/scanner in the office here for a couple of years. It’s a dependable little office helper, and does a good enough job of scanning for office paperwork. The old XP laptop has long been the scanning portal for our office.  Remote Desktop into the laptop, scan stuff into [...]

Jun 092011
 

Ah, WPF.  You’ve dotted your tees and crossed your eyes and your data bound control is still not showing any data from your collection.  You set a breakpoint in the property getter that is providing the collection data, the breakpoint gets hit and returns your data, but the data doesn’t appear at the other end [...]

 

I’ve been exploring the recent CTP5 release of .NET Entity Frameworks 4.0.  I find the advancements in the “Code First” model of entity modeling encouraging, though I am a little concerned about discoverability.  If things just magically happen when you name your properties just the right way, how will you know how to diagnose and [...]

Side Effects of Hash-Bang URLs

 Posted by Danny Thorpe at 11:07 am  Web
Feb 092011
 

Mike Davies recently posted a scathing review of everything Lifehacker did wrong that led up to their recent site-wide outage. The root culprit, according to Davies: converting their site from using normal URLs to address content pages to using hash-bang URLs instead. I have no opinion on whether hash-bang URLs are the new root of [...]

 

If you’re trying to generate classes or a dataset from an XSD schema file using the Visual Studio XSD.EXE command line utility and the only thing you’re getting out of XSD.EXE is an error message of  Error: There was an error processing ‘xyz-schema.xml’.   – DataSet cannot instantiate an abstract ComplexType for the node . [...]

 

If you do a web search for how to use the LINQ XPathSelectElement function, the example code you will find falls into two categories:  Those that don’t use namespaces at all, and those that use the same namespace prefix in the query as in the original document. Using no XML namespace at all when querying [...]

Elastic Computing

 Posted by Danny Thorpe at 3:52 pm  Web
Oct 222010
 

Maarten Balliauw wrote a nice piece (with lots of pretty pictures and diagrams ;> ) about using Azure cloud infrastructure to take up excess load during periods of peak traffic beyond what your in-house hardware can handle.  The idea is you can run your server app on your existing hardware most of the time, but in [...]

Sep 292010
 

Starting next Monday, October 4, I will be the latest shiny new employee at BiTKOO! BiTKOO is a small private company doing great things in the identity and authorization management space. After working at Microsoft on Visual Studio extensions for the past 2+ years  (Windows Live Mesh app tools, then Visual Studio Tools for Windows [...]

 

I’m pleased to announce that the June 2010 release of Windows Azure Tools for Visual Studio is now available for free download! New features in this release: Full support for Visual Studio 2010 RTM .NET 4 support – You can now build your Windows Azure web apps and services using either .NET 3.5 or the [...]

Nov 302009
 

I just heard the news announced at PDC that the Managed Extensibility Framework, or MEF, is now slated to be included in Silverlight 4.  Great news! I did a bit of proof of concept work using MEF about a year ago.  MEF is all about composition of providers and consumers.  MEF’s main job is to [...]

 

Mike Wickstrand of the Windows Azure team has created a Windows Azure Feedback Forum to solicit feedback from you about what sorts of things/features/services you would like to see Windows Azure provide.  You can enter your own suggestions and vote for the features that you want the most.  This feedback will go directly to the [...]

Windows Azure at PDC09

 Posted by Danny Thorpe at 2:26 pm  Work
Nov 172009
 

Windows Azure, Microsoft’s platform for cloud-based applications, just rolled out a major update to sync with PDC09. We of course also rolled out a major update of the Windows Azure Tools for Visual Studio in the same push. Jim Nakashima and others will be showing our latest tools at PDC09 this week. Windows Azure Tools [...]

 
Using SecureCard and other devices with VirtualPC Virtual Machines

One of the great things about using VirtualPC in software development and testing is that the VirtualPC “virtual machine” really only has one hardware configuration.  The virtual machine defines a virtual hard disk, virtual display, virtual network, and even its own virtual BIOS for booting up the virtual machine. The downside to that uniformity is [...]

 

Microsoft announced today the release of Visual Studio 2010 beta 2 and .NET Framework 4 beta 2!  It will be available immediately for download by MSDN subscribers and for general release towards the end of this month. I can’t begin to describe all the stuff that is new and improved in this beta 2, so [...]

Oct 142009
 

Thawte has announced it will discontinue its “Web of Trust” peer to peer identity assertion program later this year. Web Of Trust enables individuals to obtain personal digital certificates without having to go through costly corporate or government paperwork. The idea is that if several trusted WoT members (notaries) assert that they have met the [...]

Oct 022009
 

Dion Almer and Ben Galbraith, cofounders of the Ajaxian web development news portal, have left their digs at Mozilla to head up the developer relations team for Palm‘s webOS.  Dion and Ben moved to Mozilla just short of a year ago to work on Bespin, a project to develop tools for building cloud applications. Share/Bookmark

Oct 022009
 

When you’re writing a rich Internet application (RIA) in HTML and JavaScript, sometimes you need to programatically place a DOM element relative to the right or bottom edge of the visible browser window. For example, if you want to popup a help balloon near an item of interest, you probably want to make sure that [...]

© 2012 Danny Thorpe Suffusion theme by Sayontan Sinha