[Xml-compile] Help with compiling serializers and de-serializers

Bill Moseley moseley at hank.org
Sun May 22 14:38:18 GMT 2011


I need some help understanding how to create subs to de-serialize a request
and then serialize operations for use in a Catalyst-based server.  I've been
working with Catalyst::Controller::SOAP, but it is hard-coded to only look
at <body> elements.  So, I'm looking for help understanding how to use
XML::Compile::SOAP better.

The WSDL
http://www.imsglobal.org/lis/lisv2p0pd/PMSbinding/wsdl11/PersonManagementSe=
rviceSyncSingle.wsdlincludes
a "createPerson" operation.

What I want to do is create two subroutine references that can be used to
decode the request XML and then to encode a response when done.

I have the following input def for "createPerson":

my $operation =3D $wsdl->operation( 'createPerson' );
warn Dumper $operation->{input_def};

$VAR1 =3D {
          'body' =3D> {
                      'use' =3D> 'literal',
                      'parts' =3D> [
                                   {
                                     'name' =3D> 'Parameters',
                                     'element' =3D> '{
http://www.imsglobal.org/services/lis/pms2p0/wsdl11/sync/imspms_v2p0}create=
PersonRequest
'
                                   }
                                 ],
                      'procedure' =3D> 'createPersonRequest',
                      'message' =3D> '{
http://www.imsglobal.org/services/lis/pms2p0/wsdl11/sync/imspms_v2p0}create=
PersonRequest
'
                    },
          'header' =3D> [
                        {
                          'use' =3D> 'literal',
                          'parts' =3D> [
                                       {
                                         'name' =3D> 'HeaderInfoParameters',
                                         'element' =3D> '{
http://www.imsglobal.org/services/lis/pms2p0/wsdl11/sync/imspms_v2p0}imsx_s=
yncRequestHeaderInfo
'
                                       }
                                     ],
                          'part' =3D> 'HeaderInfoParameters',
                          'message' =3D> '{
http://www.imsglobal.org/services/lis/pms2p0/wsdl11/sync/imspms_v2p0}create=
PersonRequest
'
                        }
                      ]
        };


There's two input sections.  Can I compile a single subroutine to
parse/de-serialize a message that includes both the header and body?  And
likewise, create a single sub to encode/serialize?

Or, do I have to look at {input_def} and {output_def} to see that there's a
header and body and then explicitly pull <Body> and <Header> elements out of
the <Envelope> and parse them separately?  (Or rather parse each part listed
in "parts" separately?)

I don't think I'm suppose to access $operation->{input_def} and
$operation->{output_def} directly, and I do not understand the documentation
for findDef().

The compile method in XML::Compile::Schema seems like what I need, but that
requires a "TYPE" that seems to be the "element" from the list of "parts"
above.

This seems more complicated than it should be, so I assume I'm doing
something wrong.



-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20110522/52=
b0b1e4/attachment.htm


More information about the Xml-compile mailing list