Apache Axis Call's soap Envelope without xml processing instruction

Hi,

I have a Axis DII client that invokes a webservice. The request the service excepts looks like this:
<!--REQUEST.................-->
<env:Envelope  xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <env:Body>
  <n1:getCityLocals  xmlns:n1="http://www.pin.com/pcs/procs/v1">
   <CP xmlns="java:com.pin.pcs.procs/v1">
    <CPRC children="true" xmlns="">      
      <cpCode>1001</cpCode>
    </CPRC>
   </CP>  
</n1:getCityLocals  >  
</env:Body>
</env:Envelope>
<!------------------------------!>

What Call object creates from my code looks like this
<?xml version="1.0" encoding="UTF-8"?> ////////difference - added
<env:Envelope  xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <env:Body>
  <n1:getCityLocals  xmlns:n1="http://www.pin.com/pcs/procs/v1">
   <CP xmlns="java:com.pin.pcs.procs/v1">
    <CPRC children="true" xmlns="">      
      <cpCode>1001</cpCode>
    </CPRC>
   </CP>  
</n1:getCityLocals  >  
</env:Body>
</env:Envelope>

The service fails when I send this request. The only difference is, addition of xml declaration and exclusion of "xmlns:soapenc=http://schemas.xmlsoap.org/soap/encoding/"

Here is my code: that creates Call and invokes the service
/****************************/
String endpoint =
             "http://localhost:8232/CPWS/CP";
        Service  service = new Service();
        Call call    = (Call) service.createCall();
       
        call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "http://schemas.xmlsoap.org/soap/encoding/");
        call.setOperationStyle(Style.DOCUMENT);
        call.setTargetEndpointAddress( new java.net.URL(endpoint) );
        call.setSOAPActionURI("");
        call.setOperation(new QName("http://www.pin.com/pcs/procs/v1"), "getCityLocals");
        call.setProperty("omit-xml-declaration", "true");
        String ret = (String) call.invoke(new Object[] { getDocument() } );
/****************************/

My question is how to remove the xml declaration and how to add soap encoding namespace to Soap Envelope. Call object creates this evelope. Any help is Greatly appreciated.

Thanks


dasvinayAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vikraman_bCommented:
0
dasvinayAuthor Commented:
Vikraman,

Thank you for the quick response. Most of the tutorial's examples are of rpc style. I am looking for document/literal examples. I could use sun's jax-rpc library instead of apache Axis. But the question still remains. Is there a way to ignore xml processing instruction while creating an Envelope, like omit-xml-declaration etc in Document.

Thanks
0
Mayank SAssociate Director - Product EngineeringCommented:
Well, I prefer to create a proxy using WSDL 2 Java and use it instead - works good.
0
dasvinayAuthor Commented:
The dynamic proxy invocation works fine. I want to use DII because I don't want to put thirdparty jars in my application. What I am looking for is a small example of how to use dii for document/literal style. I tried with apache axis, The envlope is formed correctly, but with the xml declaration on top, which the service doesn't like.

Thanks for hlep..
0
Mayank SAssociate Director - Product EngineeringCommented:
This one has some sample code for various means in which you can invoke a web-service (DII, dynamic proxy, etc):

https://bpcatalog.dev.java.net/nonav/soa/standalone-client/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.