Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Ticket #21 (closed enhancement: fixed)

Opened 5 years ago

Last modified 3 years ago

send XML Document over SOAP

Reported by: nahi <nakahiro@gmail.com> Assigned to: nahi
Priority: normal Milestone: 1.5.6
Component: soap4r Version: 1.5
Keywords: Cc:

Description (Last modified by nahi)

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/96829

and from soap4r-ML

Hi,

One of the SOAP web service that I'd like to use is asking an XML
chunk as one of its parameters. So I simly created a string and send
it.

But when I make a SOAP request with this string, the SOAP server emits
an error and resend me what I got, which is sth like that:
<Request>&lt;?xml version='1.0'?>&lt; (...) </Request>


So it seems that all "<" where replaced by "&lt;". Am I doing
something wrong? Is it the server that is on crack?

Thx in advance,

yk

Attachments

custumerr.txt (66 bytes) - added by meteostrom@hotmail.com on 07/21/06 20:14:16.
xxxx

Change History

12/05/04 22:32:27 changed by nahi <nakahiro@gmail.com>

  • owner changed from nahi to anonymous.
  • status changed from new to assigned.

12/05/04 22:55:59 changed by nahi <nakahiro@gmail.com>

  • owner changed from anonymous to nahi.
  • status changed from assigned to new.

12/13/04 22:55:38 changed by nahi <nakahiro@gmail.com>

  • milestone changed from ruby-1.8.2 to 1.5.3.

04/14/05 18:14:39 changed by nahi

  • milestone changed from 1.5.4 to 1.5.5.

This requires "document driver" and "document stub" (soap4r/lib/soap/doc; not yet exists).

09/12/05 20:53:12 changed by nahi

  • type changed from defect to enhancement.
  • milestone changed from 1.5.5 to undefined.

07/21/06 20:14:16 changed by meteostrom@hotmail.com

  • attachment custumerr.txt added.

xxxx

09/05/06 23:40:05 changed by nahi

  • description changed.
  • milestone changed from undefined to 1.5.6.

10/21/06 00:53:33 changed by nahi

from soap4r-ML

Hi,

I've been trying to get to grips with a SOAP based webservice using
soap4r and have come up against a wall; wsdl2ruby unfortunately
doesn't support xsd:ID which, of course, is being used in the
webservice I'm trying to consume and thus I can't use soap4r. So my
question is: can I simply send a raw XML query to the service? I only
want to do really simple stuff with it.

Here's an example of what I mean (in PHP):
 http://www.searchnbn.net/library/webservices/wsGridMapPHP.jsp

(That's the webservice I'm trying to work with, btw)

Many thanks in advance for any help on this. I guess I'll have to go
back to PHP on this task if I can't make any headway.

Charles

04/29/07 23:39:20 changed by nahi

from soap4r-ml.

Hi,

I'm working on writing some code to update a Microsoft Sharepoint site.
 I am having problems with the last piece.  This code calls an
UpdateListItems function with a Batch structure (below) which is
basically a list of updates.  The call takes the list that you are
trying to update and the Batch XML as parameters.

I am having problems passing the XML.  I get "Cannot map Object to
SOAP/OM. (SOAP::Mapping::MappingError)" when I try to run the code.  I
suspect I have to package the Batch XML for SOAP.

Any suggestions or a pointer in the right direction?  Thanks,

--Mark

CODE:


driver =
SOAP::RPC::Driver.new("https://www.mydomain.com/sites/test/_vti_bin/Lists.asmx","http://schemas.microsoft.com/sharepoint/soap/")

driver.default_encodingstyle =
SOAP::EncodingStyle::ASPDotNetHandler::Namespace
driver.options['protocol.http.ssl_config.verify_mode'] = nil
driver.options["protocol.http.basic_auth"] <<
['https://www.mydomain.com/sites/test/_vti_bin/', "User Name",
"Password"]

driver.add_method_with_soapaction("UpdateListItems",
"http://schemas.microsoft.com/sharepoint/soap/UpdateListItems",
"listName", "updates")

driver.wiredump_dev = STDOUT
driver.wiredump_file_base = "log"

batch = <<EOF
<Batch OnError="Continue" ListVersion="1"
ViewName="06CD8A4F-0A1A-4EF7-8D5A-7C64BF7055F4">
   <Method ID="1" Cmd="New">
      <Field Name="ID">New</Field>
      <Field Name="Title">Test 1</Field>
   </Method>
</Batch>
EOF

xml = Document.new(batch)

arg1 = "Reports"
arg2 = xml

driver.UpdateListItems(arg1, arg2)

04/30/07 21:13:02 changed by nahi

from soap4r-ml

I am looking at ways to generate the following request using SOAP in
Ruby. I am not able to get the desired XML created. Is there a way to
completely put the body of the SOAP Request in an XML file and then
provide the XML file as the input for the SOAP Request in Ruby ? ANy
help or alternative means would be appreciated.

Thanks
Chetan

============Need to generate the following Request===============
<?xml version="1.0"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/
encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema/" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance/">
  <soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/">
    <wsse:Security soap:mustUnderstand="1" xmlns:soap="http://
schemas.xmlsoap.org/wsdl/soap/" xmlns:wsse="http://docs.oasis-open.org/
wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsse:UsernameToken>
        <wsse:Username>PTDMO </wsse:Username>
        <wsse:Password>PTDMO</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
  </soapenv:Header>
  <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/
envelope/">
    <Get__CompIntfc__CUSTOMER>
      <SETID>XYZ</SETID>
      <CUST_ID>XYZ</CUST_ID>
    </Get__CompIntfc__CUSTOMER>
  </soapenv:Body>
</soapenv:Envelope>
============End of request===============

============My Ruby Code===============
require 'soap/rpc/driver'
require 'soap/header/simplehandler'
require 'rexml/document'
include REXML

class HeaderHandler < SOAP::Header::SimpleHandler
  def initialize(tag, value)
    super(XSD::QName.new(nil, tag))
    @tag = tag
    @value = value
  end

#the initial handler from the sample was wrong, it generated 2 level
of tags
  def on_simple_outbound
    @value
  end
end

driver = SOAP::RPC::Driver.new("endpoint URL", nil, "SOAPACTION" )
driver.add_method("Get__CompIntfc__CUSTOMER")
driver.headerhandler << HeaderHandler.new('username','PTDMO ')
driver.headerhandler << HeaderHandler.new('password','PTDMO ')
============End of my Ruby Code===============

05/17/07 10:47:56 changed by nahi

  • status changed from new to closed.
  • resolution set to fixed.

(In [1779]) * allow to send XML. pass a REXML::Element(includes REXML::Document) or an object which responds to to_xml to get serialized XML. closes #21.