Posts

Showing posts from 2006

model error: element "{http://...}foo" not found

As I got some reply off-line, on my previous post, it's time to gives the explanation for the first invalid WSDL.

First, here is my ANT script (build.xml), that can be used to validate any WSDL in JDeveloper 10.1.3:
<project name="blog-demo" default="all" basedir="." xmlns:o="antlib:oracle">
<property file="build.properties"/>
<target name="analyze">
<o:analyze wsdl="http://www.rajkovic.org/ws/wsdl/bads/annotatedBank.wsdl"/>
</target>
</project>
and the output
analyze:
model error: element "{http://ws.rajkovic.org/demo/annotatedBank}create-account" not found.In annotatedBank.wsdl, there is a missing element: <types>. The <schema> element cannot be a direct child of the <definitions> element. In my broken sample, the schema is invisible, and therefore the element 'create-account' cannot be found. Check the valid WSDL.

To challenge your knowledge, here …

java.net.ConnectException: Connection refused

Image
As I am still getting question related to this error, when using JDeveloper, I'll describe my troubleshooting tips here, so that it can be indexed by Google (and other search engines).

If you can access the web resource from IE or Mozilla, but can't get the WSDL to work with JDeveloper, you are most likely facing a common issue. Your HTTP proxy setup may be incorrect.


Here is the screenshoot of the configuration from JDeveloper 10.1.3.1. Last time I used JDeveloper, I was using the HTTP Analyzer feature and I forgot to turn it off before to exit the application. When I re-started JDeveloper the next day, the proxy was still setup for port 8099.

Here is a sample of the output you may get when you face this configuration error:
Buildfile: /Users/eric/devroot/build.xmlanalyze:Failed to read wsdl file at: "http://www.rajkovic.org/ws/wsdl/bads/annotatedBank.wsdl", caused by: java.net.ConnectException. : Connection refused

Remember to stop HTTP Analyzer before to exit JDeve…

Broken WSDL, but why?

I have started to rely on the XML schema validation that is embedded in JDeveloper and forgot some of the basic check I was doing manually prior to that.

To help improving on error reporting, so that we can make file easier for developers of Web Services, I'll try to compile a list of broken WSDLs, so that we can use them when looking for negative test scenario.

Here is the first one: http://www.rajkovic.org/ws/wsdl/bads/annotatedBank.wsdl. You can try it, see what error you get and if it make any sense to you. Post a comment with the error you find in this WSDL :-)

Have Fun !!!

Common JAXRPC error - unexpected element name

If you are using JAXRPC, there is an error message that may be hard to connect back to the root cause of the problem. The error message reads something like:
unexpected element name: expected=FileMetadata, actual={urn:FileUpload}FileMetadata.

There may be multiple causes for this error message. The first you want to look at is the flavor of XML schema advertized in the WSDL.

The default value for the elementFormDefault attribute is unqualified (see the w3c spec), which is what the error message above is trying to convey. In the schema section of your WSDL, make sure you can find the declaration: elementFormDefault="qualified"

Sometime, this get lost in the edits of the WSDL file, and many Web Services toolkits wont validate on the consumer side (Axis and .NET are among those). If you cannot alter the original WSDL, make a local copy that you can use to generate your artifacts, then contact the service provider so that they can make the change. The WS-I tools should be able to h…

Who needs private coaching ?

Image
Having your own private coach did not seams like something anyone will ever be able to afford. With the rising new technologies behind web2.0, I may be proven wrong...

I am still doing good with my programm to loose weight, as I have someone home that watch out for me (and my diet).

If you are not as lucky as I am, maybe you should contact Coach Valerie!!!

Googling and more...

Here are some pieces of Web2.0 I haved enjoyed today. I figure out I should share them.
How to Design a Good API & Why it Matters (1 hour worth listening too)

The S stands for Simple

I found this catching title funny:
"Want to be cool? Learn REST. Want a career? Learn WS."

learned that "to Google" is now a verb that is on some dictionary - Thanks Antoine !!!

found out why I have an iMac at home - Thanks Yobo !!! (you'll have one soon...)

and finaly, tested UberIcon from Punk Software - Thanks Olivier !!!

dmg for JDev 10.1.3.1 on MAC is available from OTN

I have missed the annoucement, so I figure other may also be looking for it:
Check the OTN download page for the latest download.
Another usefull page to bookmark are the Main Documentation and J2EE & Web Services pages.

Changing the version of JDK used by JDeveloper

I have recently learned a quick and lazy way to change the version of the JDK used to run JDeveloper 10g R3. I am sure there is an option somewhere in the configuration screen to do the same, which I couldn't find...

While JDeveloper is not running, locate the embedded JDK on disk and rename (or delete) that directory. For me, it was C:\opt\jdev\jdk. Once it's done, restart and you will by asked to locate the version of the JDK you want to use.

It's another step to get going with JAVA on Vista.

-ecco

Running Java on Vista RC2, some tips...

Image
As days go by, I am able to get more and more done on my desktop, but still to figure out how to get the productivity increase, as I was initially expecting from a modern OS.

The last issues that I was facing was IPv6 vs. IPv4, and I have now been able to google the resource that explain it all: "The Cable Guy - October 2005" on MSDN, especially the 'Disabling IPv6' section.

Unless you disable IPv6 on all interfaces, you will have to change your way to start java process. Here is my new way to launch JUnit tests from ant:
  <junit showoutput="true" fork="yes">
    <jvmarg value="-Djava.net.preferIPv4Stack=true">
...

I had to use the same option when starting the server-side process for my J2EE container. As this is not exactly lightweight, I'll have to find a better way forward (most likely hack with the registry as advised by the Cable Guy). For some reason, I was expecting to find such information from the new integrated se…

Vista RC2 - a better experience

Image
Earlier this week, I stop by Microsoft booth at Oracle Open World to check out Vista.

Back home, I did burn the DVD of RC2 and try the system upgrade from RC1.

It was just fine, and I am now back to normal network speed.

If you think about giving Vista a trial, go directly to RC2 ;-)

Connection reset from a WCF Web Service

Here is an error message you may see, when calling WCF Web Services from java:
IOException retrieving the response: java.net.SocketException: Connection reset

As it may not be obvious the first time you see it, this may save you some time.

One reason for this behaviour is when the WCF endpint is expecting to see wsa:Action SOAP header in the request.

To find out if you are facing this case, you have to look inside the WSDL, and search for the policy that describes the contract for your endpoint.


<wsp:Policy wsu:Id="CustomBinding_Echo1_policy">
  <wsp:ExactlyOne>
    <wsp:All>
      <wsaw:UsingAddressing/>
    </wsp:All>
  </wsp:ExactlyOne>
</wsp:Policy>


To make this a concrete example, here is a sample WSDL. To find the policy, you will need to follow the import as the policy are not always advertized in the top-level document.

Here is how the import looks:

  <wsdl:import namespace="http://example.org/" location="http://.../WSAdd…

Productivity Hints

Image
It's funny to see how creative developers can be when they are testing their features, or is this really that hard to slice Angel Cake?

Just a random screen, as I was starting the latest version of JDeveloper 10.1.3.1 on my iMac.

Going the Vista way

Image
As a geek, and an iMac user at home, I had to try the newly released Windows Vista, after my recent trip to Redmond.

Microsoft is even branding its refreshment after its new baby.

After a clean install and a seamless connection on the corporate network, with access to the network printers and the shared disks on my linux systems, it was time to start reel work.

My luck started to go south. Connecting my iPod shuffle on the keyboard's USB connector to access it as a memory stick did bring up an error pop-up.

Next was a strange behavior when scrolling into my Java applications. After a quick email to the in-house guru, and a pointer to this blog, I was back on track...



Since this morning, I have been trying to download the latest JDK from Sun's web site, so that I can get my Java applications in a usable state, and I am back to the stone age on the modem speed.

I'll need to figure out which setup I need to tweak to get back the the ligthning speed of modern computers.

Let see how i…

MTOM the Oracle way

I just saw the annoncement from Tug on the OTN Web Services forum about a new HowTo: Use MTOM to Exchange Binary Data Using Web Services

Nice work Tug!

I hope this is the first in a long serie...

-ecco

2006-09-01: A Date To Remember

Today is a big date for me and my new diet.

The initial goal was to loose over 20 pounds. On the scale at the gym, the magic number was 22!!!

Yes, 22 pounds since I started in early July after our vacation in southern California.

Let see where I go from here...

-ecco

Oracle SOA Suite 10.1.3 Developer Preview

In case you did not see the news, the new Oracle SOA Suite 10.1.3 Developer Preview is available from OTN for download. Check it out !!!

In the Web Services front, there are some new features available to make your life easier. Over the next weeks, I'll try it out on my new home computer and share some of the findings here.

To share you experience and give us feedback, visit the Web Services forum on OTN.

-ecco

.NET Web Service response is null on client side

If you are trying to use a .NET client to invoke some Web Service, and you are getting an empty result (or return value) one of the possible explaination is that the format of the SOAP response on the wire does not match the format advertise in the WSDL.

Unlike most JAX-RPC stacks who will fault in such case, when deserialization fails (XML 2 JAVA), the .NET stack ignore the unexpected nodes, and continue processing with the default value for the types, based on the CLR dafault behaviour.

When you are in doubt, remember to capture the SOAP payload for manual introspection and try with another client stack.

-ecco

A Book on Database Web Services

For those that want to interface the Oracle Database with Web Service, there is a nice book just good released for you: Oracle Database Programming Using Java and Web Services, by Kuassi Mensah

Finding messages with HTTP Analyzer

Image
I got catch by surprise a few times, trying to capture SOAP messages with JDeveloper's integrated HTTP Analyzer and figured out it's worth sharing with others. Here it is.

When using JDeveloper's HTTP Analyzer to capture messages exchanges, I sometime get the wrong proxy setting, forget about it, fix it and try to run, run and run without to see any message captured. In reallity, messages are captured but are not displayed when you keep the focus on the Data pane.

Remember to watch the next/previous message buttons in the toolbar. If they are blue (not disabled), you have message captured, as shown in Figure 2. Just click on the button to display one of the messages. You can also switch back to the history pane, as shown in Figure 3.

Here are the screens, with some hint highlighted with red-circle.


Figure 1 - HTML Analyzer with focus on the Data pane


Figure 2 - Same HTML Analyzer with focus on the Data pane, after running the test


Figure 3 - HTML Analyzer with focus on the Histo…

Ted Neward on Web Services

If you are into Web Service, and are trying to understand where the industry is going, you should take a few minutes and listen to this interview on the ServerSide: Ted Neward - Web Services and Security.

If you don't have the time to check it out, here are some highlight from the transcript:

I have to go to each of the vendors and I have to beat them over the head with a two-by-four to stop making web services look like RPC calls.Start from your code, just sprinkle some web service magic pixie dust on it and lo and behold you have a web service, bad things, bad, bad, bad, bad. I need to beat the vendors over the head to stop doing that... That’s just not going to work.If you're out there today building a web service and you're not downloading the other platform and working with that as part of your test suites. If you're building a Java web service, you have to download the .NET framework, you have to download NUnit and you have to write your unit tests as NUnit .NET u…

unacceptable symbols

Recently, as I was following our IT policies and run Windows Update, I got the following message:
"This item updates the Bookshelf Symbol 7 font included in some Microsoft products. The font has been found to contain unacceptable symbols. After you install this item, you may have to restart your computer."

How can Microsoft expect you will run your business on Windows 2003 Advanced Server and be OK the restart your computer for a silly font with a symbol in the wrong place?

I don't get it...

For the full story, check this detailed blog entry.

Failed to find wsa.jar.

Just realized as I am working on some sample code with JDeveloper 10.1.3 and the WSA ant targets that there is a warning that can be missleading to new users.

Here is what you see in the 'Apache Ant - Log' window:
Buildfile: C:\dev\howto\xml-client\build.xml

genproxy:
Failed to find wsa.jar.
BUILD SUCCESSFUL
Total time: 11 seconds
In my environment, with the build.properties file generated by JDeveloper, the issue was that the environment variable used a relative path.

#Wed May 31 23:39:13 PDT 2006
javac.debug=on
oracle.home=../../../opt/jdev/
...

WSA is looking for oracle.home or oc4j.home to locate oc4j.home/webservices/lib/wsa.jar

Using an absolute path is all it takes to get ride of the extra warning.
#Wed May 31 23:39:13 PDT 2006
javac.debug=on
oracle.home=/opt/jdev/
...

For more details, see 'Setting Up Ant for WebServicesAssembler'

No big deal, just noise.

Susan Duncan Filtering the Muddy Waters of Web Services, SOA, Oracle ADF and tools

Susan, welcome to the blogsphere.
Here is a new resource for SOA and Web Services:Susan Duncan Filtering the Muddy Waters of Web Services, SOA, Oracle ADF and tools. If you are looking for some pointers to get your WSS services going, you should at it to your feed.

-ecco.

Just for Fun

Image
Sometime, a picture is worth a thousand words. This one says it all. In other words, when it does not works as expected, "the problem is most likely between the chair and the keyborad", another version of R.T.F.M.

JDeveloper's WSDL Editor - how to get better clues

Image
Recently, I have been helping customers with broken WSDL files. I decided it would be valuable to others as well. Here are my 2 tips.

JDeveloper Editor
As you can see in the screen shoot below, you can get usefull hint from the WSDL editor in JDeveloper 10g R3:

Switch the Editor view from Design to Source.
If there is any syntax error, you will see some orange or red on the right side of the screen.
If you mouse-over the lines that are underline in orange or red, you will see the pop-up window with some information describing the syntax error. In this case, there is something wrong with the <include> element.



Once you have the first hint, you are on the right path to solve your problem. The next step is to compare the broken WSDL with other valid samples. It becomes easier to figure out that the include element need to be wrapped and is not in the expected namespace.
  <wsdl:types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema"
     targetNamespace="http://w…

BPEL Process Tracing

When you are dealing with Web services, there is a common problem that you have to deal with; Capturing SOAP request/response as they flow on the wire between the client and the service endpoint.

Tug's blog entry give you all the steps required to be successful with the setup, when using Oracle BPEL process manager.

I have to try using Tug's instruction in conjunction to Mindreef's SOAPscope to see how it works. At first, it looks very promising.

-ecco

Having Fun playing on the Internet

If you are looking for something to do over the weekend, as the rain returns here are some cool links I wanted to share:

For the youngsters: Visit http://www.jigkids.com/ and complete your own puzzle online.

For the older: The Sudoku of the day

And for the rest of us, just a little reading from the 2005 Darwin Awards finalists.

-ecco

Web Services and XML Documents

For some it's obvious. As it was not for me, I decided to put it on e-paper so that you can google this when you need it.

If you want to exchange XML Document, meaning the whole content of an XML file, with Web services, you should not use org.w3c.dom.Document or any other object representation of your XML DOM tree in your method signature. Instead, you should be using a Plain Old Types (POT) like String or byte[].

Take the following code sample, here using JSR-181 annotations:

@WebMethod
public Document getDocument(String input) {
  Document res = null;
  try {
    DOMParser builder = new DOMParser();
    builder.parse(new StringReader(STR_XML_DOCUMENT));
    res = builder.getDocument();
  } catch (Exception ex) {
    ex.printStackTrace();
  }
  return res;
}

private static final String STR_XML_DOCUMENT =
  "<?xml version=\"1.0\"?>\n" +
  "<!DOCTYPE module PUBLIC\n" +
  "\"-//Puppy Crawl//DTD Check Configuration 1.2//EN\"\n" +
  "\&qu…

unexpected null value for literal data

There is a challenge that is hard to overcome at first; making sense of error messages.You can always Google with the text of the error, “unexpected null value for literal data” and hope to be lucky. If you are using Oracle Application Server 10.1.3.0, here is the explaination for the message and two ways out.The Exception:
unexpected null value for literal data
at oracle.j2ee.ws.common.util.exception.JAXRPCExceptionBase.<init>(JAXRPCExceptionBase.java:52)
at oracle.j2ee.ws.common.encoding.SerializationException.<init>(SerializationException.java:26)
...
The relevant schema:
<complexType name="Customer">
<sequence>
<element name="address" type="tns:Address"/>
<element name="firstName" type="string"/>
<element name="lastName" type="string"/>
</sequence>
</complexType>
A sample code that will cause this exception:
public void testServ() throws Exception {
ServiceSo…

360 Degree DB Programming

Welcome to the blogging world, Kuassi.

I'll have to check 360 Degree DB Programming and learn new tips and tricks from you.

Goog luck with this new endhavour :-)
-ecco

XML processor or Regex, that is the question.

Sometime, you have to wonder why something works the way it does. The most recent time I had to scratch my head, was when trying to showcase the integration of Web services with the Office 2003 Research pane. It let me wonder what SOAP toolkit is used to build the client side piece. The answer came from the wire; some homegrown client, identified as 'Microsoft Office/11.0 (Windows NT 5.2; Microsoft Office 11.0.6568; Pro)' in the user-agent field.If you scope the namespace as Microsoft expects them to be, based on the WSDL they advertise, or include a whitespace between the parameter element and the registration response, it won't work. And the error is displayed as "No services were added because the service provider did not provide any valid information." - not exactly true...When you put this is context of other papers, like 'Why XML Security is Broken', it make it all clear - The XML processing is most likely limited to some kind of optimized text proc…

Can I dance with you?

I don't know how to Tango, but I still want to dance with you.

I just came across Harold's blog entry about Sun's project Tango and Arun's "It takes 2 to tango" post. As they put it, the focus is to have interop working between Sun and Microsoft. What about the other platforms? Hopefully, we will get back to the 'true interop' model and the n*m spirit of SOAPBuilder. It will benefit all users of Web services, and make investment in the technologie worthwile.

From the outcome of the plugfest event, you get the guaranty that you will be able to call Microsoft endpoints from your platform and that you can host Microsoft-friendly services, that customer's of the .NET platform can consume.

The missing piece: any level of confidence that your customers will be able to consume your own flavor of WSDL, if you are not using the Microsoft style and formats - see my post on Office 2003 for such example, were the WSDL is following the WS-I profile bu…

Where is my code ?

Image
Just find a new 'feature' in JDeveloper 10gR3 that was surprising at first. When you use the "Create Web Service Proxy" wizard, there is only one icon in the Application Navigator. Trying to locate the java classes by opening the packages structure won't work.

Here are two options:
Switch to the System Navigator.

Open the Structure pane and select the proxy node - the 'Round4XSDTestProxy' node in the Application Navigator. The content of the structure pane will list all the classes, including the Client class that contains the main method for your quick tests.

Happy coding,
-Ecco

Oracle Application Server 10g Release 3

The 10.1.3.0 has been going live over the weekend. Here are few link worth adding to your bookmark shortlist: Documentation, Web services APIs Javadoc, and HowTo's.

If you did not get the bits yet, here they are. Download version 10.1.3 of Oracle Application Server 10g and Oracle JDeveloper 10g.

Happy coding!
-Ecco

JDeveloper 10gR3 and Web Services

Image
If you are planing on developing Web Services on the Oracle stack, using the latest 10.1.3 preview available, I have a couple of tips for you:
Once you are done with the HelloWorld sample service, consider moving from the wizard-based development model to the ant-based scripting on top of WSA - the underlying Web Service Assembler utility.If you have decided to use the CLI [Command Line Interface] mode to build your simple services, just because an IDE is not for you, I have the same recomendation to make: consider moving from the CLI base model to the ANT base development environment.Here are my main reasons for that:JDeveloper's support for annotation (JSR-181) is not intuitive as you have to joggle between code changes and re-enter the wizard while WSA does give you a more predictible development process. Note that you need JDK 1.5.x in order to leveareage annotations - It's the only way to handle SOAP header in bottom-up scenario, if you need to have a rational for using an…

MS Office 2003 - Generated code with no parameter

In the process of getting my Web services integrated with the Office 2003 desktop suite, I run into another issue, which is again anoing. Even with a WSDL that adhers to WS-I BP1.x, the experience, out off the box is not that snooth.

The sympthome: the VBA code generated for each operation, do not have any parameter or return value. Here is a simple example with 2 operations.

Public Sub wsm_getVersion()
...
Public Sub wsm_echoString()
...

At first, this code looks fine, and there is no error message, warning, or hint of any kind that can be used to figure that the code generated is not functional. Before to delve into the WSDL and Schema definition, here is the code that one would have expected.

Public Function wsm_getVersion() As String
...
Public Function wsm_echoString(ByVal str_input As String) As String
...

The problem: The wizard is not able to process the type definition of any top-level element, unless the type definition is inlined. Here is the sample output element/type defition for th…

Web Services Design Tips - SOAPAction

Recently, I have been asked why a service was not working without the infamous SOAPAction, and I figured out I should try to explain it, one for all. Let me know if it works for you.
As the SOAPAction is transport specific -an HTTP header field, you should try to avoid it's use when authoring WSDL files for your new services, especially if you plan to use other transports for the same service. There are only a few usecases where you really need it: it's when you are using 'bare-style' document-literal binding or overloaded method (if your language of choice permit it).
The Key to this problem is to understand the relationship between the WSDL and the wire format, and to realize that the name of the wsdl:operation is not necessary present on the wire. Let's take an example to clarify this point. Here is a simple JAVA interface, that will be our samle code today:
Figure 1. Sample JAVA SEI
public interface SEI extends java.rmi.Remote {
public String lookupPhone(String eid)