Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7845141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:07:53+00:00 2026-06-02T17:07:53+00:00

I am trying to use SharePoint Web service to retrieve list changes but there

  • 0

I am trying to use SharePoint Web service to retrieve list changes but there seems to be a namespace conflict between what the jax-ws client generates and what SharePoint will accept. Below is the xml that is generated by jax-ws.

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Body>
    <GetListItemChanges xmlns="http://schemas.microsoft.com/sharepoint/soap/">
      <listName>Documents</listName>
      <viewFields>
        <FieldRef Name="Modified"/>
        <FieldRef Name="_CheckinComment"/>
        <FieldRef Name="Title"/>
        <FieldRef Name="Created"/>
      </viewFields>
      <since>1970-01-01T00:00:00</since>
      <contains/>
    </GetListItemChanges>
  </S:Body>
</S:Envelope>

i need to remove the xmlns=”http://schemas.microsoft.com/sharepoint/soap/&#8221; from GetListItemChanges. I have tried the following (and various permutations thereof) but the changes seem to be ignored. The xmlns is removed when debugging but the output xml does not change.

public class SharePointSoapHandler implements SOAPHandler<SOAPMessageContext> {
  ...
 @Override
  public boolean handleMessage(SOAPMessageContext p_soapMessageContext) {
    try {
      SOAPMessage l_soapMessage = p_soapMessageContext.getMessage();
      l_soapMessage.getSOAPBody().getFirstChild().getAttributes().removeNamedItem("xmlns");
      l_soapMessage.saveChanges();
      ByteArrayOutputStream l_outputStream = new ByteArrayOutputStream();
      l_soapMessage.writeTo(l_outputStream);
      m_logger.info(new String(l_outputStream.toByteArray()));
    } catch (Exception ex) {
      m_logger.error("Soap exception modifying xml for request", ex);
    }
    return true;
  }
}

Am I missing something? Is there a better way to accomplish this or do I need to generate the xml by hand?

EDIT: A valid soap request using soap ui. jax-ws drops the second prefix and moves the xmlns attribute.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
   <soapenv:Header/>
   <soapenv:Body>
      <soap:GetListItemChanges>
         <!--Optional:-->
         <soap:listName>Shared Documents</soap:listName>
         ...
         <soap:since>2012-02-15T00:00:00</soap:since>

      </soap:GetListItemChanges>
   </soapenv:Body>
</soapenv:Envelope>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:07:54+00:00Added an answer on June 2, 2026 at 5:07 pm

    See Changing the default XML namespace prefix generated with JAXWS for using a handler to intercept the soap and modify it as needed; also a useful technique for debugging the soap as its sent over the wire.

    you can also set the namespace declarations in the soap header like so:

    SOAPMessage request = factory.createMessage();
    SOAPEnvelope envelope = request.getSOAPPart().getEnvelope();
    envelope.addNamespaceDeclaration("uri", "uri:foo.bar.com");
    request.saveChanges();

    and then create elements with the namespace prefix like this:

    SOAPBody body = request.getSOAPBody();
    SOAPElement ping = body.addChildElement("foo", "uri");

    without setting the declaration in the header first, adding the element with the prefix will fail.

    doing things this way seems to circumvent having the namespace declaration hanging off of body nodes, which was breaking what i was trying to do.

    here’s my jUnit test that i used to verify this works:

    public void testPing() throws Exception {

    String endpoint = "http://www.foo.bar/ws/someWebservice";
    QName port = new QName(endpoint, "uri");
    QName serviceName = new QName(endpoint, "someWebserviceMethod");

    Service service = Service.create(serviceName);
    service.setHandlerResolver(new MyHandlerResolver());
    service.addPort(port, SOAPBinding.SOAP11HTTP_BINDING, endpoint);

    Dispatch<SOAPMessage> dispatch = service.createDispatch(port, SOAPMessage.class, Service.Mode.MESSAGE);
    MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
    SOAPMessage request = factory.createMessage();

    SOAPEnvelope envelope = request.getSOAPPart().getEnvelope();
    envelope.addNamespaceDeclaration("uri", "uri:bar.foo");
    request.saveChanges();

    SOAPBody body = request.getSOAPBody();

    SOAPElement element = body.addChildElement("someRequestElement", "uri");
    SOAPElement child = ping.addChildElement("someRequestChild");

    SOAPElement text_node = child.addChildElement("someTextNode");
    messageType.addTextNode("test text");

    request.saveChanges();

    System.out.println();
    request.writeTo(System.out);
    System.out.println();

    Object o = dispatch.invoke(request);

    System.out.println("ret: " + o.toString());

    assertNotNull( o );

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use jQuery to get data from an ASP.NET web service (SharePoint
Following on from suggestions, I am trying to use List.GetItems(Query) to retrieve my initial
I'm trying to use the object model of Sharepoint 2007 to make some changes
I'm building a custom web part for SharePoint and I'm trying to use the
I'am trying to retrieve all site and subsite in sharepoint but i get access
I'm trying to retrieve list data from a Sharepoint 2010 server using the webservice
I was trying to use ajax control toolkit in sharepoint 2010, but i get
I'm trying to use the sharepoint API to deploy some solutions and the global
I'm trying to use PowerShell with SharePoint. I'd like my PowerShell scripts to load
I'm trying to learn to call SharePoint Web Services from an external C# client.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.