xml generation through soap
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: xml generation through soap

  1. #1
    Join Date
    May 2015
    Posts
    94

    xml generation through soap

    Hi All,

    Sorry i was away for sometime, as i was on break. But now back, as always back here. This forum has helped a lot in my earlier discussions. Thankyou.

    Now to my Q, I am trying to change the code which was already there.

    This uses the soap functionality to generate xml format code.
    Code:
    string CIMSSubscription::PublicRegInfo::DownloadIMSUserProfile(const string & sPrivateId) const
    {
    	string sUserProfileXML;
    
    	map<string, CIMSSubscription::PublicIdInfo>::const_iterator iIterPubInfo = mPublicId2PublicIdInfo.begin();
    
    	ns1__tIMSSubscription * ptIMSSubscription = soap_new_ns1__tIMSSubscription(new soap(SOAP_IO_KEEPALIVE), -1);
    
    	ptIMSSubscription->PrivateID = sPrivateId;
    
    	ns1__tServiceProfile * pSerProf = soap_new_ns1__tServiceProfile(ptIMSSubscription->soap, -1);
    
    	while (iIterPubInfo != mPublicId2PublicIdInfo.end())
    	{
    		ns1__tPublicIdentity * pPublicId = soap_new_ns1__tPublicIdentity(ptIMSSubscription->soap, -1);
    
    		pPublicId->BarringIndication = iIterPubInfo->second.bBarringIndication;
    		pPublicId->Identity = iIterPubInfo->second.sIdentity;
    		pSerProf->PublicIdentity.push_back(pPublicId);
    
    		iIterPubInfo++;
    	}
    
    	ptIMSSubscription->ServiceProfile.push_back(pSerProf);
    
    	stringstream *ssOutputBuf = new stringstream();
    	ptIMSSubscription->soap->os = ssOutputBuf;
    
    	ptIMSSubscription->soap_serialize(ptIMSSubscription->soap);
    
    	soap_write_ns1__tIMSSubscription(ptIMSSubscription->soap, ptIMSSubscription);
    
    	sUserProfileXML = ssOutputBuf->str();
    
    	delete ssOutputBuf;
    
    	soap_destroy(ptIMSSubscription->soap);
    	soap_end(ptIMSSubscription->soap);
    	soap_done(ptIMSSubscription->soap);
    
    	soap_delete_ns1__tIMSSubscription(ptIMSSubscription->soap, ptIMSSubscription);
    
    	return sUserProfileXML;
    }
    Here we can see the PublicId is within the ServiceProfile. But in the final message I am seeing the PublicId outside the service profile. Could some c++, xml experts help me.

    The output Im getting is :
    eXtensible Markup LanguageeXtensible Markup Language
    <?xml
    version="1.0"
    encoding="UTF-8"
    ?>
    <ns1:tIMSSubscription
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:cwmp="urnslforum-org:cwmp-1-0">
    <ns1:PrivateID>
    460000000000004@ims.mnc000.mcc460.3gppnetwork.org
    </ns1:PrivateID>
    <ns1:ServiceProfile
    href="#_1"/>
    </ns1:tIMSSubscription>
    <id
    id="_1"
    xsi:type="ns1:tServiceProfile">
    <ns1:PublicIdentity>
    <ns1:PublicIdentity>
    </id>
    Last edited by pdk5; August 31st, 2017 at 10:52 AM.

  2. #2
    Join Date
    May 2015
    Posts
    94

    Re: xml generation through soap

    Any help on this:

    The code looks quite simple, the PublicId is within the ServiceProfile structure in the code.
    Not sure why in the output via wireshark, it is coming outside ?

    @tubular, laserlight and kaud, can you spare few mins to help me with this ?

    thanks
    pdk

  3. #3
    Join Date
    May 2015
    Posts
    94

    Re: xml generation through soap

    I think I found the issue, the soap is using href for big structures, so it is displayed later.

    Not sure how i can change this though

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)