Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

XML File to network share

Former Member
0 Likes
1,188

Hi,

I'm following the instructions as laid out in the

"Rendering a DOM tree into an XML document" document via the SAP Library. It basically lays out creating an XML DOM and writing out that DOM. The example code works great if I want to write to the root drive of the application server using the following line of code:

oStream = streamFactory->create_ostream_uri ( system_id = 'file://test.out.xml' ).

Let me repeat the above works fine if I want to write to the application servers root drive. My problem is that I wish to write my XML file to a network share.

So far I've tried:

oStream = streamFactory->create_ostream_uri(
system_id = 'file:\servernametest.out.xml' ).
oStream = streamFactory->create_ostream_uri(
system_id = 'file://\servernametest.out.xml' ).
oStream = streamFactory->create_ostream_uri(
system_id = 'file:servernametest.out.xml' ).

Nothing seems to work. With each attempt a null is returned as reference to the oStream object. Am I doing something wrong? Did I miss something? Is this possible?

Any help would be greatly appreciated...

Thanks

Brian

Hi,

I'm following the instructions as laid out in the

"Rendering a DOM tree into an XML document" document via the SAP Library. It basically lays out creating an XML DOM and writing out that DOM. The example code works great if I want to write to the root drive of the application server using the following line of code:

oStream = streamFactory->create_ostream_uri ( system_id = 'file://test.out.xml' ).

Let me repeat the above works fine if I want to write to the application servers root drive. My problem is that I wish to write my XML file to a network share.

So far I've tried:

oStream = streamFactory->create_ostream_uri(
system_id = 'file:\servernametest.out.xml' ).
oStream = streamFactory->create_ostream_uri(
system_id = 'file://\servernametest.out.xml' ).
oStream = streamFactory->create_ostream_uri(
system_id = 'file:servernametest.out.xml' ).

Nothing seems to work. With each attempt a null is returned as reference to the oStream object. Am I doing something wrong? Did I miss something? Is this possible?

Any help would be greatly appreciated...

Thanks

Brian

5 REPLIES 5
Read only

christian_wohlfahrt
Active Contributor
0 Likes
894

Hi Brian,

just a option, which you didn't try:

system_id = 'file://servername/test.out.xml'

Some OS use forward slash, some backward. In Windows you use the backward slash (
servername), but it seems your application server expects '/' in path definition.

Regards,

Christian

Read only

0 Likes
894

Thanks for the reply, I did try this:

system_id = 'file://servername/test.out.xml'

But received the same results.

Read only

0 Likes
894

Hi,

it was worth a try. Otherwise I can't help much further, just one question (were I'm not any longer sure, if it's worth a try):

Can you access the network path from application server root, e.g. with LS (or DIR or CD) command? (Maybe your mounted volumes are linked on a different directory level.)

Regards,

Christian

Read only

Former Member
0 Likes
894

You can try the following instruction:

oStream = streamFactory->create_ostream_uri

( system_id = '
servername\filename.xml\' ).

This is because the function uses URL Format.

Also, you can replace servername with an IP address like

oStream = streamFactory->create_ostream_uri

( system_id = '
10.3.1.2\filename.xml\' ).

Read only

0 Likes
894

Sorry, in my last post you have to remove the last '\' from the instructions.

The real code for both instructions is:

oStream = streamFactory->create_ostream_uri

( system_id = '
servername\filename.xml' ).

or

oStream = streamFactory->create_ostream_uri

( system_id = '
10.3.1.2\filename.xml' ).

Sorry.