William Reichardt wrote:

I am having problems making simple web service calls using Dynamic
invocation of an Axis based web service using WSIF. I have attached the
WSDL for the service to this email. The WSDL is a sample WSDL using the
WSDM spec. I am using the most recent HEAD from CVS for my WSIF
implementation.

I am trying to make a dynamic invocation call on the GetResourceProperty operation. This operation imports its input and
output messages from the WSRP WSDL.


  <portType name="DiskPortType"
wsrp:ResourceProperties="tns:DiskProperties">
     <operation name="GetResourceProperty">
        <input name="GetResourcePropertyRequest"
message="wsrp:GetResourcePropertyRequest"/>
        <output name="GetResourcePropertyResponse"
message="wsrp:GetResourcePropertyResponse"/>
        <fault name="ResourceUnknownFault"
message="wsrp:ResourceUnknownFault"/>
        <fault name="InvalidResourcePropertyQNameFault"
message="wsrp:InvalidResourcePropertyQNameFault"/>
     </operation>

The first problem I encountered was that the imported schemas were not
being pulled in unless I set the following features.

factory.setFeature(WSIFConstants.WSIF_FEATURE_AUTO_MAP_TYPES,
Boolean.TRUE);
char[] chars = new char[0];
factory.setFeature(WSIFConstants.WSIF_FEATURE_PROXY_AUTHENTICATION, new
PasswordAuthentication("", chars));

Unless these were set, my imported schemas were being ignored (See
WSIFServiceImpl constructor and .init()). I am not using authentication
at all. Is there a better way to get my WSDL information imported?


hi,

that looks like a bug if it is the case however i was not able to access imported WSDL at all, from outside hp.com it is not possible to read:
http://mip.esr.hp.com/wsdm/wsdl/MUWS.wsdl
(specified in WSDL in <xsd:import namespace="http://docs.oasis-open.org/wsdm/2004/04/muws-0.5/schema"; schemaLocation="http://mip.esr.hp.com/wsdm/wsdl/MUWS.xsd"; />)


My second problem is in actually being able to fill in the fields of the
input message. I have tried many combinations of input.setObjectPart but
do not seem able to fill in the input document properly. The schema
fragment for wsrp:GetResourceProeprtyRequest is ...

<xsd:element name="GetResourcePropertyRequest" type="xsd:QName" />

which is pretty straight forward, but it is from an external document.

I attempt to set a QName for this value by doing a....

       QName qn = new QName("http://xyz.com/","BlockSize";);
       input.setObjectPart("GetResourcePropertyRequest",qn);

and get the following:

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> <soapenv:Header>
<prop:To
xmlns:prop="http://my.org/uri/";>http://localhost:8080/wsdm</prop:To>
<prop:Action
xmlns:prop="http://my.org/uri/";>http://schemas.xmlsoap.org/ws/2004/03/addressing</prop:Action>
<prop:ResourceID
xmlns:prop="http://my.org/uri/";>1234</prop:ResourceID> </soapenv:Header> <soapenv:Body> <GetResourcePropertyRequest xsi:type="xsd:QName" xmlns=""
xmlns:ns1="http://xyz.com/";>ns1:BlockSize</GetResourcePropertyRequest> </soapenv:Body>
</soapenv:Envelope>
The problem with this document is that GetResourcePropertyRequest
namespace is not defined (xmlns=""). It also has an xsi:type attribute
which I do not want included as I am doing document style.


The only way I could get the request to look the way I needed it to was
to do the following. (Which I think defeats the purpose of using WSIF in
the first place..)

DocumentBuilderFactory docFactory =
DocumentBuilderFactory.newInstance();
docFactory.setNamespaceAware(true); DocumentBuilder builder = null;
try {
builder = docFactory.newDocumentBuilder();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Document doc = builder.newDocument();
Element elem =
doc.createElementNS("http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties";, "GetResourcePropertyRequest");
elem.setAttribute("xmlns:m","http://xyz.com";);


       Text text = doc.createTextNode("m:BlockSize");
       elem.appendChild(text);
       input.setObjectPart("GetResourcePropertyRequest",elem);

This version produced the following request which is what the WSDL
actually requires.

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";> <soapenv:Header>
<prop:To
xmlns:prop="http://my.org/uri/";>http://localhost:8080/wsdm</prop:To>
<prop:Action
xmlns:prop="http://my.org/uri/";>http://schemas.xmlsoap.org/ws/2004/03/addressing</prop:Action>
<prop:ResourceID
xmlns:prop="http://my.org/uri/";>1234</prop:ResourceID> </soapenv:Header> <soapenv:Body>
<ns1:GetResourcePropertyRequest xmlns:m="http://xyz.com";
xmlns:ns1="http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties";>m:BlockSize</ns1:GetResourcePropertyRequest> </soapenv:Body>
</soapenv:Envelope>
Notice there is no longer any xsi:type and GetResourcePropertyRequest
is qualified now.


Am I using WSIF incorrectly or is this the only way I can build this
request?


i think WSIF2 needs lot of improvements in doc/literal support (AXIS as well ...) especially when doing anything more than really basic XML schema constructs ...

thanks,

alek

--
The best way to predict the future is to invent it - Alan Kay



Reply via email to