In the past I had to do something similar.  I just used a code block to call a classmethod.  The classmethod accepted the context variable by reference.  All you would need to do is loop on the OBX segments and clone the message for each segment which meets your criteria.  Then you would need to remove any extraneous segments.  Once complete you would just need to add each message to an index you created in the context variable.  That way you could loop, transform and send each message in the index in your BP using a foreach.

Are you asking about something like this?  From an Ensemble perspective this is returning something of type  %GlobalCharacterStream.  There is no wrapper class around the %GlobalCharacterStream.  For the consumer of your web service this will appear as a string in the WSDL.
Method SomeMethodName(FacilityID As %String) As  %GlobalCharacterStream [ WebMethod ]
{

// where the response of this method is an object of type %GlobalCharacterStream
quit ##class(SomeClassName).ReturnAStream(FacilityID)
}